A "Toast" which is a quick small message window which does not take the focus. (Java.lang.object)
AlertDialog is used to open a dialog from our activity. This modal dialog gets the focus until the user closes it.
An instance of this class can be created by the builder pattern, e.g. you can chain your method calls.
You should always open a dialog from the class onCreateDialog(int) as the Android system manages the dialog in this case for you. This method is automatically called by Android if you call showDialog(int).
Syntax:
AlertDialog showAlert=new AlertDialog.Builder(this).create();
showAlert.setTitle("it's clicked");
showAlert.setMessage("are you sure you want to Burn?");
showAlert.setButton("Burn",new OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.cancel(); }
});
showAlert.show();
No comments:
Post a Comment