Java tutorial
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { private static Toast mToast; public static void showShortToast(Context context, int message) { showShortToast(context, context.getString(message)); } public static void showShortToast(Context context, CharSequence message) { if (context == null) return; if (mToast == null) { mToast = getToastObj(context); } mToast.setText(message); mToast.setDuration(Toast.LENGTH_SHORT); mToast.show(); } private static Toast getToastObj(Context context) { return Toast.makeText(context, "", Toast.LENGTH_SHORT); } }