I am learn about android programming in my free time. I am planned to create a simple alert window with a button. We can use AlertDialog class to create android alert window in Android. The sample output using this class as like picture below.
I have created a simple function how to create Android alert window using AlertDialog class. Please check this subroutine :
private void showAlertOk(String strtitle, String strtext, String strbutton)
AlertDialog.Builder builder = new AlertDialog.Builder(formQuestions.this);
builder.setPositiveButton(strbutton, new DialogInterface.OnClickListener()
public void onClick(DialogInterface dialog, int which)
//add our code in here
We can give parameter to this Android alert window subroutine to give same result like picture above using command :
showAlertOk("Information", "Please select the right answer", "Close")
I hope this simple subroutine can give you more explaining about how to create alert window in Android.
My name is Toto Sugito. This is my notes when I try something. Maybe, this is NOT THE BEST SOLUTION for your problems. If you have other method or idea that better with my post, please share in this blog. Thank for visiting my site.