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 (context == null) { return null; } Toast t = Toast.makeText(context, textMessage == null ? "Oops! " : textMessage.trim(), timeDuration); t.show(); return t; } }