Example usage for android.widget Toast show

List of usage examples for android.widget Toast show

Introduction

In this page you can find the example usage for android.widget Toast show.

Prototype

public void show() 

Source Link

Document

Show the view for the specified duration.

Usage

From source file:org.getlantern.firetweet.util.Utils.java

public static void showOkMessage(final Context context, final CharSequence message, final boolean longMessage) {
    if (context == null || isEmpty(message))
        return;/*from ww w.  j a v a 2  s .  c  o m*/
    final Toast toast = Toast.makeText(context, message, longMessage ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
    toast.show();
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void showErrorMessage(final Context context, final CharSequence message,
        final boolean longMessage) {
    if (context == null)
        return;// w ww. j  av  a  2 s  .com
    final Toast toast = Toast.makeText(context, message, longMessage ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
    toast.show();
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void showWarnMessage(final Context context, final CharSequence message,
        final boolean longMessage) {
    if (context == null || isEmpty(message))
        return;/*from   w  w  w .  j  a  v  a2  s.c  om*/
    final Toast toast = Toast.makeText(context, message, longMessage ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
    toast.show();
}

From source file:org.getlantern.firetweet.util.Utils.java

public static void showInfoMessage(final Context context, final CharSequence message,
        final boolean long_message) {
    if (context == null || isEmpty(message))
        return;//w w w.  jav  a 2  s  . c o m
    final Toast toast = Toast.makeText(context, message, long_message ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
    toast.show();
}

From source file:de.vanita5.twittnuker.util.Utils.java

public static void showMenuItemToast(final View v, final CharSequence text, final boolean isBottomBar) {
    final int[] screenPos = new int[2];
    final Rect displayFrame = new Rect();
    v.getLocationOnScreen(screenPos);/*  w w w.j  a v  a 2 s.  c  o m*/
    v.getWindowVisibleDisplayFrame(displayFrame);
    final int width = v.getWidth();
    final int height = v.getHeight();
    final int screenWidth = v.getResources().getDisplayMetrics().widthPixels;
    final Toast cheatSheet = Toast.makeText(v.getContext(), text, Toast.LENGTH_SHORT);
    if (isBottomBar) {
        // Show along the bottom center
        cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
    } else {
        // Show along the top; follow action buttons
        cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT, screenWidth - screenPos[0] - width / 2, height);
    }
    cheatSheet.show();
}

From source file:com.skytree.epubtest.BookViewActivity.java

private void showToast(String msg) {
    Toast toast = Toast.makeText(this, msg, Toast.LENGTH_SHORT);
    toast.show();
}