Java tutorial
//package com.java2s; import android.content.*; import android.view.Gravity; import android.widget.Toast; public class Main { public static void showLToast(Context context, String text) { Toast toast = Toast.makeText(context, text, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } public static void showLToast(Context context, int resId) { Toast toast = Toast.makeText(context, resId, Toast.LENGTH_LONG); ; toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } }