Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.widget.Toast; public class Main { /** * Show a Toast message * @param context The context * @param strId The string resource id */ public static void showToast(Context context, int strId) { showToast(context, context.getString(strId)); } /** * Show a Toast message * @param context The context * @param str The string content */ public static void showToast(Context context, String str) { if (context != null) { Toast.makeText(context, str, Toast.LENGTH_SHORT).show(); } } }