Android Toast Create showToast(String text, Context context)

Here you can find the source of showToast(String text, Context context)

Description

Displays a text message via the toast notification system.

License

Open Source License

Parameter

Parameter Description
text the text message to display

Declaration


public static void showToast(String text, Context context) 

Method Source Code

//package com.java2s;
/**/*  w  ww  .j  ava  2 s  . com*/
 * Copyright (c) 2011: mnemr.com contributors. All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published 
 * the Free Software Foundation, either version 3 of the License, 
 * (at your option) any later version.
 *
 * program is distributed in the hope that it will be 
 * but WITHOUT ANY WARRANTY; without even the implied warranty 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See 
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 **/

import android.content.Context;

import android.widget.Toast;

public class Main {
    /**
     * 
     * Displays a text message via the toast notification system.
     *  If a previous message is still visible, the previous message is first removed.
     *   @param text
     * 
     *            the text message to display
     */

    public static void showToast(String text, Context context) {

        Toast.makeText(context, text, Toast.LENGTH_SHORT).show();

    }
}

Related

  1. makeToast(String msg, int length, Activity mainAct)
  2. displayToast(String message, Activity activity)
  3. showToast(Context context, String message)
  4. showToast(Context context, int id)
  5. showToast(Context context, int stringId)
  6. showToast(final Context context, String text)
  7. showToast(final Context context, final String message)
  8. showToast(final Context context, final String string)
  9. showToast(final Context context, final int resId)