Java tutorial
//package com.java2s; import android.content.Context; import android.view.Gravity; import android.widget.Toast; public class Main { public static void ShowToast(Context context, String message) { Toast msg = Toast.makeText(context, message, Toast.LENGTH_SHORT); msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2); msg.show(); } }