Here you can find the source of showToast(final Context context, final String string)
private static void showToast(final Context context, final String string)
//package com.java2s; //License from project: Apache License import android.content.Context; import android.os.Handler; import android.os.Looper; import android.widget.Toast; public class Main { private static void showToast(final Context context, final String string) { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override/* w w w . ja v a 2 s . c o m*/ public void run() { Toast.makeText(context, string, Toast.LENGTH_LONG).show(); } }); } }