In Android, when I create Toast and show them, they appear consecutively. The problem is that I have a button that checks some fields and if the user enters incorrect data,
Have only one Toast in this activity.
private Toast toast = null;
Then just check if there's currently a Toast being shown before creating another one.
if (toast == null || !toast.getView().isShown()) {
if (toast != null) {
toast.cancel();
}
toast = Toast.makeToast("Your text", Toast.LENGTH).show();
}
You can even make that last snippet into a private method showToast(text) to refactor code if you need to display different text messages.