Java tutorial
//package com.java2s; import android.content.Context; import android.view.Gravity; import android.widget.Toast; public class Main { private static Toast toast; public static void show(Context paramContext, int paramInt) { if (paramContext == null) { return; } show(paramContext, paramContext.getString(paramInt)); } public static void show(Context paramContext, CharSequence paramCharSequence) { if (paramContext == null) { return; } if (toast == null) { toast = Toast.makeText(paramContext, paramCharSequence, Toast.LENGTH_SHORT); } else { toast.setText(paramCharSequence); } toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } }