Android Toast Create showToast(final Context context, final int resId)

Here you can find the source of showToast(final Context context, final int resId)

Description

show Toast

License

Open Source License

Declaration

private static void showToast(final Context context, final int resId) 

Method Source Code

//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();

            }
        });
    }
}

Related

  1. showToast(Context context, int stringId)
  2. showToast(String text, Context context)
  3. showToast(final Context context, String text)
  4. showToast(final Context context, final String message)
  5. showToast(final Context context, final String string)
  6. showToast(final Context ctx, final Handler handler, final String text, final int duration)
  7. showToast(final Context ctx, final Handler handler, final int id, final int duration)
  8. showToast(final String toast, final Context context)
  9. showToast(final String toast, final Context context)