Java tutorial
//package com.java2s; import android.content.Context; import android.widget.Toast; public class Main { public static Toast showToast(Context context, String textMessage, int timeDuration) { if (null == context) { return null; } textMessage = (null == textMessage ? "Oops! " : textMessage.trim()); Toast t = Toast.makeText(context, textMessage, timeDuration); t.show(); return t; } }