Here you can find the source of showToast(final Context context, final int resId)
private static void showToast(final Context context, final int resId)
//package com.java2s; //License from project: Open Source 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 int resId) { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override//from ww w .j ava2s . c om public void run() { Toast.makeText(context, resId, Toast.LENGTH_LONG).show(); } }); } }