Java tutorial
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { public static Toast toast = null; private static void show(Context context, int resId, int duration) { if (toast == null) { toast = Toast.makeText(context, resId, duration); } else { toast.setText(resId); } toast.show(); } private static void show(Context context, String message, int duration) { if (toast == null) { toast = Toast.makeText(context, message, duration); } else { toast.setText(message); } toast.show(); } }