Here is the code to dismiss the multiple toast messages.
Toast toast;
public void showToast(String message){
try{
toast.getView().isShown(); // true if visible
toast.setText(message);
} catch (Exception e) { // invisible if exception
toast = Toast.makeText(ToastDismissDemo.this, message, Toast.LENGTH_SHORT);
}
toast.show();
}
public void showToast(String message){
try{
toast.getView().isShown(); // true if visible
toast.setText(message);
} catch (Exception e) { // invisible if exception
toast = Toast.makeText(ToastDismissDemo.this, message, Toast.LENGTH_SHORT);
}
toast.show();
}
No comments:
Post a Comment