Here you can find the source of showToast(String text, Context context)
Parameter | Description |
---|---|
text | the text message to display |
public static void showToast(String text, Context context)
//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(); } }