The most simple dialog
An example of the most simple dialog box with a single button.
Make OnClick method:
DialogInterface.OnClickListener doNothing = new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface arg0, int arg1)
{
// For example, complete the Activity
finish();
}
};
Show dialog:
new AlertDialog.Builder(this)
.setMessage("YOUR_MESSAGE")
.setNeutralButton("BTN_CAPTION", doNothing)
.setCancelable(false)
.create().show();
Written by GangrenaGastrit
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Java
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#