SubscribeSubscribe with Androidlift to get new post on mail.

Custom alert dialog android

Custom Alert Dialog

is for my own reference actually but if someone is looking for a solution on how to create a custom alert dialog, then this is the right tutorial for you.For simple alert dialog visit here.

In this tutorial i created a new layout file under res/layout as custom_confirm_dialog.xml .

I have shown the custom alert dialog when app starts but you can also do it using button click or anywhere else.

MainActivity.java

When user clicks on ok or cancel button then there is a callback methods from interface get calls and then our appropriate methods gets called from activity.

those methods are as follows =

Note : –  here in both methods the first parameter is dialog interface instance and second one is interger identifier to match the our exact custom alert dialog.

I created one separate class for custom alert dialog so that we can use it again and again.

CustomAlertDialog.java

The interface i used is DialogClickInterface.java

activity_main.xml

Output :

That sit..we are done here ..Enjoy coding..!

(19)