简体   繁体   中英

Android Toast doesn't show up

I am using a Samsung Galaxy Note 8 with Android 8.0.

My Toast message (which was working) does not show up

Toast.makeText(this, "ABC", Toast.LENGTH_SHORT).show();

getApplicationContext() , getBaseContext() are not helping instead of this. Using this in an activity .

Go to your app settings -> Notifications and check if notifications are turned on. This action is possible in newer android versions

Even though a Toast is not a notification, it seems that NotificationManagerService.java will not show Toast if Notifications are disabled.

I'm posting a link with the issue: https://issuetracker.google.com/issues/36951147

try with class name

Toast.makeText(ActivityName.this, "ABC", Toast.LENGTH_SHORT).show();

here ActivityName is your activity name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM