Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Resources; import android.widget.Toast; public class Main { public static void showTips(Context ctx, String msg) { int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(ctx, msg, duration); toast.show(); } public static void showTips(Context ctx, int msgStringId) { Resources rc = ctx.getResources(); String msg = rc.getString(msgStringId); showTips(ctx, msg); } }