Java tutorial
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { private static Toast toastShort; /** * Shows toast for short duration */ public static void toastShort(Context context, String msg) { if (context == null) return; if (toastShort != null) toastShort.cancel(); toastShort = Toast.makeText(context, msg, Toast.LENGTH_SHORT); toastShort.show(); } }