Equivalent to MessageBox on Android?

What was that? (It will have a [OK] button.)

Thanks for any help.

+4
source share
3 answers

Dialog .

Subclasses for it exist that may be more / less suitable for you. Take a specific look at the AlertDialog class. There is also an AlertDialog.Builder subclass that helps create an AlertDialog .

+4
source

In this case, use the Toast class.

+2
source

Here is a simple use of AlertDialog:

  AlertDialog alertDialog = new AlertDialog.Builder(theContext).create(); alertDialog.setTitle("End Game?"); alertDialog.setMessage("Are you sure you wish to end the game?"); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { finish(); } }); alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE, "No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { } }); alertDialog.show(); 

I thought that I would add what I did after I came across this page, as it would be useful for me to see !! - Hope this helps the next guy or girl :-)

+1
source

All Articles