LearnFast.Ninja

Android notification example code using toast make text

Use Toast object and use the makeText method. Android toast example after click on negativeButton in the dialog box.

Step 1: Use Toast object and use the makeText method.

// Toast.makeText(context, text, duration).show();
Toast.makeText(Hello_AndoridActivity.this, "Data not saved.", 5).show();

Step 2: Android toast example after click on negativeButton in the dialog box.
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
Toast.makeText(Hello_AndoridActivity.this, "Data not saved.", 5).show();
}
})

Result:


Tags

android

toast notification message