androidandroid-toast

Android Toast message doesn't show


I know there are some other issues regard this problem, however, mine is surprisingly different (at least I think so).

I guess my code is right but I don't have idea why toast message doesn't display. Firstly, I couldn't see toast message in my Fragments. Then I decided to put it in my activity and amazingly it doesn't display here too.

This is code of my Activity which has been extended from FragmentActivity.

@Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        Log.d(TAG, "***************************");
        Log.d(TAG, "*** Application started ***");
        Log.d(TAG, "***************************");

        // assign layout to activity
        setContentView(R.layout.activity_main);

        mContext = MainActivity.this;
        Toast.makeText(mContext, "Hello World", Toast.LENGTH_SHORT).show();

.
.
.
} 

Application works fine without error and just this f.toast message doesn't display! I even replaced mContext with getApplicationContext() and I had same result, toast does not display.

Any suggestion would be appreciated. Thanks

===============

Update: When I open Toast class there are some red lines. please look at image below

enter image description here


Solution

  • Perhaps you have accidentially disabled notifications for your app in the settings? This causes no toasts too.