Android examples for User Interface:Toast
Singleton to show a toast
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { private static Toast toast; /**// ww w . j ava2 s .c o m * Singleton to show a toast * @param context Application context * @param message Toast message */ public static void makeSingleShowToast(Context context, int message) { if (toast != null) { toast.cancel(); } toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); toast.show(); } }