2

I am working on android application . I need to create a notification for the app. I am able to create it successfully using :

http://www.tutorialspoint.com/android/android_notifications.htm

I know NotificationCompat.Builder setNumber(int Number) . It sets the number on the notification on the right hand side . But instead of the number i want to show a small icon. Do i need to use a custom layout , Because i am not able to find any API for this . How do i do it .

Pardeep Kumar
  • 900
  • 1
  • 14
  • 30
  • Try with Custom Notifications refer http://www.androidbegin.com/tutorial/android-custom-notification-tutorial/ – Sathish Kumar J Jun 07 '16 at 11:54
  • @SathishKumarJ In method CustomNotification(), when we are using builder.setContent(remoteViews); , then why do we need to use builder.setSmallIcon(R.drawable.logosmall) . Becuase As i understand setContent is for customview setting and setSmallIcon is for standard view setting. – Pardeep Kumar Jun 07 '16 at 12:05

1 Answers1

0

To show an image at the bottom right end of the notification, we have to use the following APIs

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(baseContext).setLargeIcon(large_icon)
                .setSmallIcon(small_icon);

For devices running up to android Kitkat the setLargeIcon sets the image at the left end, while the setSmallIcon sets the image at the bottom right end of the notification.

For devices running on higher than Kitkat the setLargeIcon sets the image at the Left end, while the setSmallIcon sets the image at the bottom right end of the Large Image.

F43nd1r
  • 7,690
  • 3
  • 24
  • 62
Pardeep Kumar
  • 900
  • 1
  • 14
  • 30