I am working on displaying an Android Toast message from an IntentService. After a bit of research and understanding how Loopers, Handlers and Message queues work, I implemented the solution found here: Toast on an IntentService
I find that in addition to the latest toast, the previous toast messages are displayed in order. Can anyone explain what is happening and how to resolve this?
private static void toast(final Context context, final String message, final int duration){
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast toastMsg = Toast.makeText(context, message , duration);
}
});
}