Android Stop toast notification programatically? <p>Is there a way I can stop a toast message programatically? </p> <p>Say I have a button which I click to scroll through toast messages, and in the onclick event I wanted to stop all in the queue and just show the new one, how would I do that?</p> <p>Thanks,</p> <p>Ben</p> <p>A simplified version of my code is below - Code:</p> <pre><code>public class Help extends Activity{ LinearLayout background; int screenNo = 1; Toast toast; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.help); background = (LinearLayout) findViewById(R.id.helpLayout); ImageButton next = (ImageButton) findViewById(R.id.imageButtonNext); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { toast.cancel(); showNextScreen(); }}); } private void showMessageBox(String title, String msg) { AlertDialog.Builder b = new AlertDialog.Builder(this); b.setTitle(title); b.setMessage(msg); b.setPositiveButton("Next", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { showNextScreen(); }}); b.setNegativeButton("Quit Help", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { returnHome(); }}); b.show(); } private void showNextScreen() { int time = 7000; String tstMsg = "error"; switch (screenNo) { case 1: break; case 2: break; case 3: break; case 4: break; case 5: toast.cancel(); returnHome(); break; default: break; } if(screenNo &lt; 5) { toast=Toast.makeText(this, tstMsg, time); toast.setGravity(Gravity.BOTTOM, 0, 0); toast.show(); screenNo++; } } } </code></pre>