How to show different icons for status bar and notification bar in Android?

james picture james · Jul 15, 2014 · Viewed 13.1k times · Source

I'm creating android notification according to android documentation. I used large icon and small icon for Notification bar.

In this case small icon is showing on both status bar and notification bar . I want to show different icons for status bar and notification bar, how i can achieve that ?

Answer

erdemlal picture erdemlal · Nov 25, 2014

In the documentation; there are notification area and notification drawer, i think in your case status bar means the notification area. You can use the following code to create a notification by setting both small icon and large icon.

Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_icon);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this).setSmallIcon(R.drawable.logo).setLargeIcon(bm).setContentTitle("title").setContentText("body");

Large icon is a bitmap and it is shown in notification drawer, small icon is shown in notification area but also in the notification drawer, in the bottom right corner of the large icon. It must be entirely white. If the small icon is colorful, it is shown as a white square in the notification area.