Arduino Uno

Header

Corner

AlertDialog

Sometime you certainly need to ask the user to comfirm something, like for example leaving an activity.

new AlertDialog.Builder(this)
	.setIcon(android.R.drawable.ic_dialog_alert)
	.setTitle("Quit activity?")
	.setMessage("Are you sure you want to quit this activity?")
	.setPositiveButton("Yes", new DialogInterface.OnClickListener()
	{
		@Override
		public void onClick(DialogInterface dialog, int which) 
		{
		   finish();    
		}
	})
	.setNegativeButton("No", null)
	.show();