Toast show - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Toast show method.

This code example shows how to use the following methods: setDuration, setView, show
		TextView message = (TextView) toastLayout.findViewById(R.id.message);
		message.setText("This is my own message");
	} 
 
	public void showMessage(View view) {
		Toast toast = new Toast(this);
		toast.setDuration(Toast.LENGTH_LONG);
		toast.setView(toastLayout);
		toast.show();
	} 
} 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setDuration, setGravity, setView, show
	 *           the gravity 
	 */ 
	public static void showCustomToast( int viewResId, int duration, int gravity ) {
		View layout = getLayoutInflater().inflate( viewResId, null );
 
		Toast toast = new Toast( mContext.getApplicationContext() );
 
		toast.setGravity( gravity, 0, 0 );
		toast.setDuration( duration );
		toast.setView( layout );
		toast.show();
	} 
	 
	static PorterDuffColorFilter mWhiteMultiplyFilter = new PorterDuffColorFilter( 0xFFFFFFFF, Mode.MULTIPLY );
 
	/** 
	 * Draw folder icon. 
	 *  
	 * @param folder 
	 *           the folder 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setDuration, setGravity, setView, show
This code example shows how to use the following methods: getXOffset, getYOffset, setGravity, show
        } 
 
        // inform users of how long the timeout is now 
        final String toast = makeTimeoutToastString(context, screenTimeout);
        mToast = Toast.makeText(context, toast, Toast.LENGTH_LONG);
        mToast.setGravity(Gravity.CENTER, mToast.getXOffset() / 2, mToast.getYOffset() / 2);
        mToast.show();
    } 
 
    @Override 
    protected List<Uri> getObservedUris() {
        return OBSERVED_URIS;
    } 
 
    @Override 
    protected boolean handleLongClick(Context context) {
        Intent intent = new Intent("android.settings.DISPLAY_SETTINGS");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setText, show
     */ 
    public static void showToast(int message, Toast mToast, Context context) {
        if (mToast == null) {
            mToast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
        } 
        mToast.setText(context.getString(message));
        mToast.show();
    } 
 
    /** 
     * @param context 
     * @return meow 
     */ 
    public static AnimationDrawable getNyanCat(Context context) {
        final AnimationDrawable animation = new AnimationDrawable();
        for (int i = 0; i < 12; i++) {
            try { 
                animation.addFrame(Drawable.createFromStream(
                        context.getAssets().open("Frame" + i + ".png"), null), 75);
            } catch (IOException e) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Toast show Questions & Answers:

Other Toast show Examples

41:	  @Override
42:	  public boolean onOptionsItemSelected(MenuItem item) {
43:	    Toast.makeText(this, "Just a test", Toast.LENGTH_SHORT).show();
44:	    return true;
45:	  }

Read More

73:	  public void onProviderEnabled(String provider) {
74:	    Toast.makeText(this, "Enabled new provider " + provider,
75:	        Toast.LENGTH_SHORT).show();
76:	
77:	  }
-
80:	  public void onProviderDisabled(String provider) {
81:	    Toast.makeText(this, "Disabled provider " + provider,
82:	        Toast.LENGTH_SHORT).show();
83:	  }
84:	}

Read More

24:	        .hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
25:	      Toast.makeText(this, "No camera on this device", Toast.LENGTH_LONG)
26:	          .show();
27:	    } else {
28:	      cameraId = findFrontFacingCamera();
-
29:	      if (cameraId < 0) {
30:	        Toast.makeText(this, "No front facing camera found.",
31:	            Toast.LENGTH_LONG).show();
32:	      } else {
33:	        camera = Camera.open(cameraId);

Read More

67:						Toast.makeText(getApplicationContext(),
68:								"Please enter category name", Toast.LENGTH_SHORT)
69:								.show();
70:					}
71:				}

Read More

42:						Toast.makeText(getApplicationContext(),
43:								"Please enter category name", Toast.LENGTH_SHORT)
44:								.show();
45:					}
46:				}

Read More

76:				Toast.makeText(getApplicationContext(),
77:						"Sorry! Your device doesn't support camera",
78:						Toast.LENGTH_LONG).show();
79:				// will close the app if the device does't have camera
80:				finish();
-
164:					Toast.makeText(getApplicationContext(),
165:							"User cancelled image capture", Toast.LENGTH_SHORT)
166:							.show();
167:				} else {
168:					// failed to capture image
-
169:					Toast.makeText(getApplicationContext(),
170:							"Sorry! Failed to capture image", Toast.LENGTH_SHORT)
171:							.show();
172:				}
173:			} else if (requestCode == CAMERA_CAPTURE_VIDEO_REQUEST_CODE) {
-
180:					Toast.makeText(getApplicationContext(),
181:							"User cancelled video recording", Toast.LENGTH_SHORT)
182:							.show();
183:				} else {
184:					// failed to record video
-
185:					Toast.makeText(getApplicationContext(),
186:							"Sorry! Failed to record video", Toast.LENGTH_SHORT)
187:							.show();
188:				}
189:			}

Read More

show Method Overview
Show the view for the specified duration.
See Code Examples for other Android Toast Methods: