Notification Bar shows both Large and Small Icons

The notification bar in my application shows only the small icon in the ticker (as it should). However, when the “shade” is pulled down, it shows both the small icon from the ticker, as well as a large icon that I set in the Notification.Builder. Here’s my code:

if (Build.VERSION.SDK_INT > 10){
            notification = new Notification(R.drawable.ic_stat_mintchip,
                    "This is a test",
                    System.currentTimeMillis());
            notification.largeIcon = (((BitmapDrawable)c.getResources().getDrawable(R.drawable.ic_launcher)).getBitmap());
            notification.defaults |= Notification.DEFAULT_ALL;
            notification.number += 1;
            notification.flags |= Notification.FLAG_AUTO_CANCEL;

        } else {
            notification = new Notification(R.drawable.ic_stat_mintchip,
                    "This is a test",
                    System.currentTimeMillis());

                notification.flags |= Notification.FLAG_AUTO_CANCEL;
                notification.defaults |= Notification.DEFAULT_ALL;
                notification.number += 1;
        }
}

I don’t quite know why this is happening. Any assistance?

  • How to find out if a Skype call is currently active on Android
  • Java convert ArrayList to string and back to ArrayList?
  • irrlicht android on opengl es 2.0 driver
  • ProgressBar under Action Bar
  • Android - Widget with Scrollable Listview Manual Refresh
  • How to configure IntelliJ for Mac to show Java and Android documentation within the editor (offline, not online)?
  • Related posts:

    Able to choose future date when setting max date in datepicker
    How to return int array from Java to JNI
    Picasso crop to a view
    Animation not starting until UI updates or touch event
    NestedScrollView scroll down itself when content is fills
    Retrofit cannot connect to my local web server on port 3000
  • Jersey / Rest default character encoding
  • Can I scale a View in Android?
  • Nexus 7 (2013) and Win 7 64 - cannot install USB driver despite checking many forums and online resources
  • Does the V2 Maps Library require the ACCESS_NETWORK_STATE permission?
  • How to add a separator between menu items in ActionBar?
  • LocationManager: java.lang.NoSuchMethodError
  • 3 Solutions collect form web for “Notification Bar shows both Large and Small Icons”

    I think the issue here is possibly that you’re not using the Notificaiton.Builder class. Here’s a small example of what you could do (you would have to insert your own variables though, and set the other properties that you used such as vibration):

    Notification.Builder nb = new Notification.Builder(context)
        .setContentTitle("title")
        .setContentText("content")
        .setAutoCancel(true)
        .setLargeIcon(largeIcon)
        .setSmallIcon(R.drawable.small_icon)
        .setTicker(s.getText());
    NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(100, nb.build());
    

    Another issue i had in android lollipop is that the small icon was displayed next to the large icon. To solve it – just don’t set the large icon! Use only the small icon setting.

    http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
    if you set your max sdk version in android manifest to 19(i.e KitKat) Your app will no longer display notifications meant for lolipop

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.