Java tutorial
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { /** * Displays the message as a Toast on the UI */ public static void displayToast(Context context, String msg) { Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); } /** * Displays the string corresponding to the resourceId as a Toast on the UI */ public static void displayToast(Context context, int resourceId) { displayToast(context, context.getResources().getString(resourceId)); } }