I\'ve been using a common \"myToast\" which I use \"myToast.cancel()
prior to issuing a new toast. For Android v2.3 and older, this works great. When a new toas
Did nandeesh's solution not work for you? His solution would be cleaner than using two different toasts.
For example, (expanding on his/her answer) prior to onCreate we'd declare the toast:
private Toast myToast;
and in onCreate we'd have to initialize it using makeToast (otherwise we'd get an error):
myToast = Toast.makeText(getApplicationContext(), null, Toast.LENGTH_SHORT);
and whenever we want a toast to be shown we'd simply call:
myToast.setText("some text");
myToast.show();
and this would replace the previous toast properly.
cancel()
doesn't do anything I'm afraid.
I would suggest using Crouton https://github.com/keyboardsurfer/Crouton