Here you can find the source of showToast(final Activity ctx, final String text, final int position, final boolean alive)
public static void showToast(final Activity ctx, final String text, final int position, final boolean alive)
//package com.java2s; import android.app.Activity; import android.widget.Toast; public class Main { public static void showToast(final Activity ctx, final String text, final int position, final boolean alive) { ctx.runOnUiThread(new Runnable() { @Override/*from w w w . ja v a 2 s . com*/ public void run() { if (!alive) { return; } Toast toast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT); toast.setGravity(position, 0, 0); toast.show(); } }); } }