Text Notification Pop-Up (using Toast)

1 vote · 1 comment

Text notifications (called Toast which appear briefly above all activities are very easy to produce.

raw ·
copy
· download
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
Add a comment

1 Comment

These are easy to produce, but be careful: you can only call show() from the main GUI thread of your app, otherwise Toast gets confused and won't remove the message after the timeout period. See my other snippet about how to use Toast in an AsyncTask to get around this problem and be able to use Toast in any thread context ..

Reply · Sept. 8, 2011, 8:29 a.m.