Stop all toast messages when going to another screen in Android
I am displaying a simple Toast when I click a button. My issue is, when I click on a button multiple times, that Toast message keeps displaying until I get to the main screen. I would like to stop the Toast when I get to the main screen and kill the Toast message in the corresponding activity. I have attached a screenshot. I have written code as follows: public class Main extends Activity { Dialog d; Toast t; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ((Button