Best code examples for Toast makeText method (android.widget.Toast.makeText)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Toast makeText method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Toast makeText examples from Open Source projects
This code example shows how to use the following methods: finish, startActivity, setClass, makeText
61:	Toast.makeText(context,message,Toast.LENGTH_LONG).show(); 
-
63:	Intent i = new Intent().setClass(context, TabWidget.class); 
64:	context.startActivity(i); 
-
66:	context.finish(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: finish, makeText
208:	Toast.makeText(host, text, Toast.LENGTH_SHORT).show(); 
-
211:	host.finish(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getResources, makeText
90:	final int screenWidth = context.getResources().getDisplayMetrics().widthPixels; 
-
92:	* context.getResources().getDisplayMetrics().density); 
-
94:	Toast cheatSheet = Toast.makeText(context, text, Toast.LENGTH_SHORT); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: runOnUiThread, getString, makeText
83:	showToast( activity, activity.getString( resId, formatArgs ) ); 
-
104:	sToast = Toast.makeText( activity, message, Toast.LENGTH_SHORT ); 
-
124:	activity.runOnUiThread( sToastMessager ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getString, makeText
28:	makeToast(context, context.getString(resId)); 
-
32:	Toast.makeText(context, message, Toast.LENGTH_LONG).show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getString, makeText
23:	showToast(context, context.getString(stringResId), duration); 
-
30:	Toast toast = Toast.makeText(context, text, (duration== Duration.SHORT ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSharedPreferences, startActivity, makeText
83:	Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit(); 
-
91:	context.startActivity(accountIntent); 
-
93:	Toast.makeText(context, registration, Toast.LENGTH_LONG); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getBroadcast, getSystemService, makeText
24:	Toast.makeText(context, "onDisabled():last widget instance removed", Toast.LENGTH_SHORT).show(); 
-
26:	PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, 0); 
27:	AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getString, makeText
82:	Toast.makeText(mActivity, error, Toast.LENGTH_SHORT).show(); 
-
91:	showError(mActivity.getString(resId)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getPackageManager, makeText
91:	Toast.makeText(mContext, "Developer mode enabled", 
-
116:	PackageManager pm = mContext.getPackageManager(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getString, makeText
88:	String str = context.getString(prompt); 
-
93:	Toast toast = Toast.makeText(context, prompt, Toast.LENGTH_SHORT); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getString, makeText
306:	mToast = Toast.makeText(context, "", Toast.LENGTH_SHORT); 
-
308:	mToast.setText(context.getString(message)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: startActivity, makeText
215:	context.startActivity(i); 
-
217:	Toast.makeText(context, ex.getMessage() + " for " + url, Toast.LENGTH_LONG).show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getSystemService, makeText
12:	Toast.makeText(context, "Don't panik but your time is up!!!!.", 
-
16:	.getSystemService(Context.VIBRATOR_SERVICE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: finish, makeText
54:	Toast.makeText(activity, "Your evil remote control has exploded! Now Astroboy is FREEEEEEEEEE!", Toast.LENGTH_LONG).show(); 
55:	activity.finish(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getSystemService, makeText
21:	PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); 
-
36:	Toast.makeText(context, msgStr, Toast.LENGTH_LONG).show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: startActivity, makeText
113:	Toast t = Toast 
-
120:	context.startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS")); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getResources, makeText
59:	Toast.makeText(mMain, mMain.getResources().getString(mId), Toast.LENGTH_LONG).show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: startActivity, makeText
30:	activity.startActivity(dialIntent); 
-
32:	Toast.makeText(activity, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: startActivity, makeText
95:	this.a.startActivity(this.i); 
-
98:	Toast.makeText(this.a, "no activity found", Toast.LENGTH_LONG).show(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setSpan, makeText
52:	Spannable text = new SpannableString("Italic green text in toast"); 
53:	text.setSpan(new StyleSpan(Typeface.ITALIC), 0, 18,  Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 
54:	text.setSpan(new ForegroundColorSpan(Color.GREEN), 0, 18,  Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 
55:	Toast.makeText(this, text, Toast.LENGTH_LONG).show(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
86:	mNM = (NotificationManager)service.getSystemService(Context.NOTIFICATION_SERVICE); 
-
88:	Class<?> clazz = service.getClass(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
85:	mNM = (NotificationManager) mService.getSystemService(Service.NOTIFICATION_SERVICE); 
-
87:	mStartForeground = mService.getClass().getMethod("startForeground", 
-
89:	mStopForeground = mService.getClass().getMethod("stopForeground", 
-
97:	mSetForeground = mService.getClass() 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
86:	mNM = (NotificationManager)service.getSystemService(Context.NOTIFICATION_SERVICE); 
-
88:	Class<?> clazz = service.getClass(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: stopForeground
303:	service.stopForeground(true); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setForeground
138:	context.setForeground(true); 
139:	getNotificationManager(context).notify(ONLINE_NOTIFICATION, newRunningNotification(context)); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: startForeground
119:	context.startForeground(ONLINE_NOTIFICATION, newRunningNotification(context)); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: startForeground
186:	context.startForeground(ONLINE_NOTIFICATION, newRunningNotification(context)); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
85:	mNM = (NotificationManager)service.getSystemService(service.NOTIFICATION_SERVICE); 
-
87:	Class<?> clazz = service.getClass(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSystemService
33:	mLocationManager = (LocationManager)service.getSystemService(Context.LOCATION_SERVICE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSystemService, getClass, setForeground
55:	startForeground = service.getClass().getMethod("startForeground", startForegroundSignature); 
-
72:	service.setForeground(true); 
-
75:	(NotificationManager) service.getSystemService(Context.NOTIFICATION_SERVICE); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: sendBroadcast
86:	mCurrentService.sendBroadcast(mWidgetUpdate); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: getSystemService, setForeground
99:	service.setForeground(false); 
100:	NotificationManager nm = (NotificationManager) service.getSystemService(Context.NOTIFICATION_SERVICE); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: startForeground
35:	service.startForeground(id, notification); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setForeground
64:	context.setForeground(false); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
86:	mNM = (NotificationManager)service.getSystemService(Context.NOTIFICATION_SERVICE); 
-
88:	Class<?> clazz = service.getClass(); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
85:	mNM = (NotificationManager)service.getSystemService(service.NOTIFICATION_SERVICE); 
-
87:	Class<?> clazz = service.getClass(); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
85:	mNM = (NotificationManager)service.getSystemService(service.NOTIFICATION_SERVICE); 
-
87:	Class<?> clazz = service.getClass(); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
85:	mNM = (NotificationManager)service.getSystemService(service.NOTIFICATION_SERVICE); 
-
87:	Class<?> clazz = service.getClass(); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: getApplication
65:	return ((WeatherSliderApplication) service.getApplication()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSystemService, getClass
34:	notificationManager = (NotificationManager) service.getSystemService(Context.NOTIFICATION_SERVICE); 
-
40:	startForegroundMethod = service.getClass().getMethod("startForeground", startForegroundMethodSignature); 
41:	stopForegroundMethod = service.getClass().getMethod("stopForeground", stopForegroundMethodSignature); 
-
47:	setForegroundMethod = service.getClass().getMethod("setForeground", setForegroundMethodSignature); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: getPackageManager, getSystemService
36:	mActivityManager = (ActivityManager) service.getSystemService(Context.ACTIVITY_SERVICE); 
37:	mPackageManager = service.getPackageManager(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getSystemService
34:	mNM = (NotificationManager)mService.getSystemService(Context.NOTIFICATION_SERVICE); 
Full Snippet Info
4
CodeRank
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 Also