Android Toast Create toast(String message, Context context)

Here you can find the source of toast(String message, Context context)

Description

toast

Declaration

public static void toast(String message, Context context) 

Method Source Code

//package com.java2s;

import android.content.Context;

import android.view.Gravity;

import android.widget.Toast;

public class Main {
    public static void toast(String message, Context context) {
        Toast msg = Toast.makeText(context, message, Toast.LENGTH_LONG);
        msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2,
                msg.getYOffset() / 2);//from w  w w  .j a va  2s  .c  o m
        msg.show();
    }
}

Related

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