Java tutorial
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { private static Toast mToast; public static void showToast(Context context, CharSequence text, int duration) { if (mToast == null) { mToast = Toast.makeText(context, text, duration); } else { mToast.setText(text); mToast.setDuration(duration); } mToast.show(); } public static void showToast(Context context, CharSequence text) { showToast(context, text, Toast.LENGTH_SHORT); } }