In the Android version of my app I display a lot of Android Toast notifications using:
Ti.UI.createNotification({ message: "MESSAGE", duration: Ti.UI.NOTIFICATION_DURATION_LONG, gravity: 17 // Gravity.CENTER }).show();as you can see, I use the NOTIFICATION_DURATION_LONG. But when I perform another action which triggers another toast notification, while the previous notification is still being shown, the subsequent notifications get queued-up and eventually displayed one after the other. To avoid this, I've tried other approaches like keeping a single version of the notification, and calling:
notification.setMessage("MESSAGE 2"); notification.show();which doesn't seem to work.
Also tried holding one global instance variable to hold the notification object, doing the below:
var notification = null; function showToast (text) { if(notification){ notification.hide(); } notification = Ti.UI.createNotification({ message: text, duration: Ti.UI.NOTIFICATION_DURATION_LONG, gravity: 17 // Gravity.CENTER }); notification.show(); }But that doesn't seem to prevent the queueing-up of the toast notifications as well.
Can someone help me find a way using which I can hide an existing toast notification???
Thanks and Regards.