Asked  7 Months ago    Answers:  5   Viewed   50 times

I have an app showing custom notifications. The problem is that when running in Android 5 the small icon in the Notification bar is shown in white. How can I fix this?



The accepted answer is not (entirely) correct. Sure, it makes notification icons show in color, but does so with a BIG drawback - by setting the target SDK to lower than Android Lollipop!

If you solve your white icon problem by setting your target SDK to 20, as suggested, your app will not target Android Lollipop, which means that you cannot use Lollipop-specific features.

Have a look at, and you'll see that the white style is how notifications are meant to be displayed in Android Lollipop.

In Lollipop, Google also suggest that you use a color that will be displayed behind the (white) notification icon -

So, I think that a better solution is to add a silhouette icon to the app and use it if the device is running Android Lollipop.

For instance:

Notification notification = new Notification.Builder(context)
            .setContentTitle("My notification")
            .setContentText("Look, white in Lollipop, else color!")

    return notification;

And, in the getNotificationIcon method:

private int getNotificationIcon() {
    boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
    return useWhiteIcon ? R.drawable.icon_silhouette : R.drawable.ic_launcher;
Tuesday, June 1, 2021
answered 7 Months ago

webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); solves the problem.

Friday, July 23, 2021
answered 5 Months ago
Sunday, August 8, 2021
answered 4 Months ago

After long time of test and trial, I finally realized..there is nothing wrong with the code or xml or styling or theme settings.

The little needle in the stack of issue was "Prevent bitmap too large to be uploaded into a texture android"

Reason, when rendering image on Screen OpenGLRenderer was not loading bitmap for high resolution devices and hence no image was coming on nexus devices.

The work around I used was to manually resize the bitmap progrmatically in onCreate() method and set as background for the layout.

Hope it helps for anyone who is not able to load background.

Feel free to query for more!!

Wednesday, October 13, 2021
answered 2 Months ago

When I change new URI for chrome bookmarks from "content://" to new URI "content://", the same issue "onChange event not triggered on Lolipop version". And, I try query data to check after observer registered... it running like a magic. I don't know why it running correctly, hope it help.

Sunday, October 17, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :