Skip to content

Instantly share code, notes, and snippets.

@shishirthedev
Created January 23, 2019 18:51
Show Gist options
  • Select an option

  • Save shishirthedev/9d04d09f76b0af5a4431fa70b9477feb to your computer and use it in GitHub Desktop.

Select an option

Save shishirthedev/9d04d09f76b0af5a4431fa70b9477feb to your computer and use it in GitHub Desktop.
public class AlertServices{
private static Toast toast;
public static void showToast(Context context, String message) {
try {
if (!toast.getView().isShown()) {
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
toast.show();
}
} catch (Exception e) {
toast = Toast.makeText(context,message,Toast.LENGTH_SHORT);
toast.show();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment