Java tutorial
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { public static void showToast(Context context, int rID, int durationType) { if (rID > 0) { Toast.makeText(context, rID, durationType).show(); } } public static void showToast(Context context, String str, int durationType) { if (!str.equals("")) { Toast.makeText(context, str, durationType).show(); } } }