Android Toast Create toast(final Context context, final CharSequence msg)

Here you can find the source of toast(final Context context, final CharSequence msg)

Description

toast

Declaration

public static void toast(final Context context, final CharSequence msg) 

Method Source Code

//package com.java2s;
import android.content.Context;

import android.os.Handler;
import android.os.Looper;

import android.widget.Toast;

public class Main {
    public static void toast(final Context context, final CharSequence msg) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override//from   ww w.  jav  a 2  s  . c  o  m
            public void run() {
                Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
            }
        });
    }
}

Related

  1. showToast(final Context ctx, final Handler handler, final int id, final int duration)
  2. showToast(final String toast, final Context context)
  3. showToast(final String toast, final Context context)
  4. showToastInThread(final Context context, final String msg)
  5. toast(String message, Context context)
  6. msgLong(Context context, String msg)
  7. msgLong(final Context c, final String msg)
  8. msgLong(final Context context, final String msg)
  9. msgShort(Context context, String msg)