Below code shows my present implementation , here am creating a toast object and closing in onPause(). This works fine until there is no queue for toasts.
public static long **savedTimeStamp=0**;
Toast showToastMessage;
if(System.currentTimeMillis()/1000 - savedTimeStamp >= 60 || savedTimeStamp==0){
showToastMessage=Toast.makeText(this.this, "Toast message", Toast.LENGTH_LONG);
showToastMessage.show();
savedTimeStamp=System.currentTimeMillis()/1000;
}
@Override
protected void onPause() {
super.onPause();
if(showToastMessage!=null)
{
showToastMessage.cancel();
}
}
Final conclusion is: Toast in Que cannot be stoped . So avoid using toast in que.