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

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

Posted by: admin June 15, 2020 Leave a comment


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);
How to&Answers:

Change to this and check again.

if(first_name.length() == 0) 
    Toast.makeText(NameOfYourActivity.this, "Please fill Name", Toast.LENGTH_SHORT).show(); 
    Utilities.writeIntoLog("Please fill Name"); 


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.


just post the google code link here.

Since Jelly Bean, users can disable notifications for a given app via “app details” settings.

A very bad and unwanted side effect is that once notifs are disabled, Toast messages are also disabled, even when the user is running the app!

You encourage to use Toast in your design guidelines, but who will want to use it if the users have the possibility to remove them, especially if the toasted message is an important feedback to display to the user…

I understand at least that Toasts could be disabled when the app is in background, but not if it is the foreground Activity.


Toast is working fine in all the version of Android. There can be couple of issues in your code like

  1. Your context is not wrong
  2. You are trying to display toast in the background thread instead of worker thread.

In your custom toast don’t set the parent in your layout inflater for example use like below

View layout = inflater.inflate(R.layout.toast_layout,null);


I had the same problem. When I invoked the code on UI thread the issue resolved for me

public void showToastMessage(final String msg) {

    runOnUiThread(new Runnable() {
        public void run() {
            Toast.makeText(BaseActivity.this, msg, Toast.LENGTH_LONG).show();