Show custom alert dialog with EditText inside it - Android Java
20 August 2015By Bhavyanshu Parasher
This 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.
Create a new layout file under res/layout
I have shown the custom alert dialog when user presses a menu item but you can also do it using button click. Just use this code in public void buttonAction(final View v) method. Now in the activity where you want to show the custom alert dialog, add
In onOptionsItemSelected(MenuItem item) add the following,
Now add the following method after onOptionsItemSelected(). This is the important part,
That’s it. If you want to see how to use a spinner inside the custom alert dialog, see this tutorial.