Java tutorial
//package com.java2s; import android.content.Context; import android.os.Handler; import android.widget.Toast; public class Main { /** * Function use through the app to show Toast information. Function is called so often from * background, that it's content is explicitly called from UIThread. * * @param appContext - application context * @param stringResourceId of text we show * @param handler to UIThread */ public static void showToast(final Context appContext, final int stringResourceId, Handler handler) { handler.post(new Runnable() { @Override public void run() { Toast.makeText(appContext, appContext.getString(stringResourceId), Toast.LENGTH_SHORT).show(); } }); } }