Android notification large icon, is there a way to remove the smaller icon on the bottom right?

android, notifications, status

Solution

Add this code after you build the notification.

   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int smallIconViewId = getResources().getIdentifier("right_icon", "id", android.R.class.getPackage().getName());

        if (smallIconViewId != 0) {
            if (notif.contentIntent != null)
                notif.contentView.setViewVisibility(smallIconViewId, View.INVISIBLE);

            if (notif.headsUpContentView != null)
                notif.headsUpContentView.setViewVisibility(smallIconViewId, View.INVISIBLE);

            if (notif.bigContentView != null)
                notif.bigContentView.setViewVisibility(smallIconViewId, View.INVISIBLE);
        }
    }

where "notif" is your built notification,

Problem

I have a notification that displays a largeicon. Is there any way to remove the smaller icon from honeycomb and above devices from this view? Obviously still keeping the small icon for the top status bar ``` NotificationCompat.Builder builder = new NotificationCompat.Builder(context) // Set required fields, including the small icon, the // notification title, and text. .setSmallIcon(R.drawable.ic_notify_status_new) .setContentTitle(title) .setContentText(text) // All fields below this line are optional. // Use a default priority (recognized on devices running Android // 4.1 or later) .setPriority(NotificationCompat.PRIORITY_DEFAULT) // Provide a large icon, shown with the notification in the // notification drawer on devices running Android 3.0 or later. .setLargeIcon(picture) .setContentIntent( PendingIntent.getActivity( context, 0, notiIntent, PendingIntent.FLAG_UPDATE_CURRENT) ); builder = getNotiSettings(builder); notify(context, builder.build()); ```

Original source

Related problems