Java tutorial
//package com.java2s; import android.content.Context; import android.view.View; import android.widget.Toast; public class Main { private static Toast g_Toast = null; public static void showToast(Context context, String toastStr) { if ((g_Toast == null) || (g_Toast.getView().getWindowVisibility() != View.VISIBLE)) { g_Toast = Toast.makeText(context, toastStr, Toast.LENGTH_SHORT); g_Toast.show(); } return; } }