Why toast message are not show in android 4.1 operating system containing mobile

AndroidRaji picture AndroidRaji · Aug 28, 2012 · Viewed 9.6k times · Source

I cant see the toast message in android 4.1 mobile. Upto yesterday I was able to see the toast message. From today only I can not see the message. Please help me.

Toast.makeText(getApplicationContext(), "hi", Toast.LENGTH_SHORT).show(); 

I have tried custom toast message also instead of toast message. But still not working.

Custom toast:

LayoutInflater inflater=getLayoutInflater(); 
View layout = inflater.inflate(R.layout.toast_layout,(ViewGroup) findViewById(R.id.toast_layout_root)); 
TextView text = (TextView) layout.findViewById(R.id.text); 
text.setText("Please fill Name"); 
Toast toast = new Toast(getApplicationContext()); 
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG); 
toast.setView(layout); 
toast.show();

Answer

Haris ur Rehman picture Haris ur Rehman · Jan 5, 2013

Toast was not showing with me in Android 4.1 because Show Notifications was checked off in my app's settings. I just went to Settings->Manage Applications->[My App] and toggled on Show Notifications and Toasts started to appear.