Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 640
james Avatar asked Jul 15 '14 10:07

james


People also ask

Can you change status bar icons on Android?

To customize it, first pull down the slider bar from the top of the screen. Next, tap on the three vertical dots in the top right corner. Now click on Status bar. You're in.


Video Answer


1 Answers

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.

like image 137
erdemlal Avatar answered Sep 21 '22 09:09

erdemlal