Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Toast icon in Android 12?

Starting with Android 12, Google show a toast message with an app icon.

My application have launcher icon. Android 12 splash screen show app icon correctly.

Show toast by code

Toast.makeText(this, "Show simple toast", Toast.LENGTH_LONG).show()

compileSdkVersion/targetSdkVersion 31

android emulator Google play Intel x86 Atom_64 System Image API Level 31, Revision 8.

How can i change this default toast icon?

enter image description here

like image 515
Denis Avatar asked Oct 19 '21 11:10

Denis


2 Answers

For me a simple restart of the device did the trick.

I had not restarted my test phone after the update to Android 12 at all. I experienced the same odd bug that a generic app icon was shown in Toasts issued by my app. I tried changing the Manifest as Mickaël‘s answer suggested. No luck. I ended up with the exact same Manifest the app had before I started debugging … and then I restarted the device. My app now displays the correct icon in Toasts reliably. What happened? Unsure. I suspect that a restart may trigger an icon cache refresh that crawls all installed apps in search for new/updated app icons.

like image 64
Y20K Avatar answered Sep 20 '22 08:09

Y20K


Seems like this issue was reported to Google, and assigned to a Google engineer: https://issuetracker.google.com/issues/202863198

like image 38
speller Avatar answered Sep 21 '22 08:09

speller