Toast makeText - 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 makeText method.

This code example shows how to use the following methods: finish, startActivity, setClass, makeText
 
    protected void onPostExecute(String message) {
        dialog.hide();
        dialog.cancel();
 
        Toast.makeText(context,message,Toast.LENGTH_LONG).show();
 
		Intent i = new Intent().setClass(context, TabWidget.class);
		context.startActivity(i);
 
        context.finish();
    } 
} 
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: finish, makeText
    } 
     
    @Override 
    protected void onPostExecute(Void unused) {
      if (text!=null) {
        Toast.makeText(host, text, Toast.LENGTH_SHORT).show();
      } 
       
      host.finish();
    } 
  } 
} 
Full Snippet Info
6
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: getResources, makeText
 
        final Context context = view.getContext();
        final int viewWidth = view.getWidth();
        final int viewHeight = view.getHeight();
        final int viewCenterX = screenPos[0] + viewWidth / 2;
        final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
        final int estimatedToastHeight = (int) (ESTIMATED_TOAST_HEIGHT_DIPS
                * context.getResources().getDisplayMetrics().density);
 
        Toast cheatSheet = Toast.makeText(context, text, Toast.LENGTH_SHORT);
        boolean showBelow = screenPos[1] < estimatedToastHeight;
        if (showBelow) {
            // Show below 
            // Offsets are after decorations (e.g. status bar) are factored in 
            cheatSheet.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL,
                    viewCenterX - screenWidth / 2,
                    screenPos[1] - displayFrame.top + viewHeight);
        } else { 
            // Show above 
            // Offsets are after decorations (e.g. status bar) are factored in 
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: runOnUiThread, getString, makeText
     * @param resId The resource identifier of the message string 
     * @param formatArgs The format arguments that will be used for substitution. 
     */ 
    public static void showToast( Activity activity, int resId, Object... formatArgs )
    { 
        showToast( activity, activity.getString( resId, formatArgs ) );
    } 
     
    /** 
     * Pop up a temporary message on the device. 
     * @param activity The activity to display from 
     * @param message The message string to display. 
     */ 
    public static void showToast( Activity activity, String message )
    { 
        if( activity == null )
            return; 
         
        if( sToast != null )
        { 

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: getString, makeText
 
	private NotificationUtil() { 
	} 
 
	public static void makeToast(Context context, int resId) {
		makeToast(context, context.getString(resId));
	} 
 
	public static void makeToast(Context context, String message) {
		Toast.makeText(context, message, Toast.LENGTH_LONG).show();
	} 
 
	public static void makeServerErrorToast(Context context) {
		makeToast(context, R.string.http_error);
	} 
 
	public static void makeServerErrorToast(Context context, String message) {
		makeToast(context,
				message + ", " + context.getString(R.string.http_error));
	} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Toast makeText Questions & Answers:

Other Toast makeText 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

62:	  public void onClick(View view) {
63:	    if (s != null) {
64:	      Toast.makeText(this, "Number of elements" + s.getWordList().size(),
65:	          Toast.LENGTH_SHORT).show();
66:	      wordList.clear();

Read More

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

Read More

65:						new AddNewCategory().execute(newCategory);
66:					} else {
67:						Toast.makeText(getApplicationContext(),
68:								"Please enter category name", Toast.LENGTH_SHORT)
69:								.show();

Read More

40:						new AddNewCategory().execute(newCategory);
41:					} else {
42:						Toast.makeText(getApplicationContext(),
43:								"Please enter category name", Toast.LENGTH_SHORT)
44:								.show();

Read More

74:			// Checking camera availability
75:			if (!isDeviceSupportCamera()) {
76:				Toast.makeText(getApplicationContext(),
77:						"Sorry! Your device doesn't support camera",
78:						Toast.LENGTH_LONG).show();
-
162:				} else if (resultCode == RESULT_CANCELED) {
163:					// user cancelled Image capture
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();
-
178:				} else if (resultCode == RESULT_CANCELED) {
179:					// user cancelled recording
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();

Read More

8:	    gridview.setOnItemClickListener(new OnItemClickListener() {
9:	        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
10:	            Toast.makeText(HelloGridView.this, "" + position, Toast.LENGTH_SHORT).show();
11:	        }
12:	    });

Read More

makeText Method Overview
Make a standard toast that just contains a text view with the text from a resource.
See Code Examples for other Android Toast Methods: