Java tutorial
//package com.java2s; import android.content.Context; import android.view.Gravity; import android.widget.TextView; import android.widget.Toast; public class Main { public static void showLongToastTop(Context context, int resId) { Toast toast = Toast.makeText(context, resId, Toast.LENGTH_LONG); toast.setGravity(Gravity.TOP, 0, 100); TextView v = toast.getView().findViewById(android.R.id.message); if (v != null) v.setGravity(Gravity.CENTER); toast.show(); } }