Honeycomb notifications - How to set largeIcon to the right size?

Not had a chance to check it yet but API 11 introduced the following public dimens:

  • notification_large_icon_height
  • notification_large_icon_width

Should be able to use those to scale your image before setting it on the notification.


I used the dimensions of the notification's large icon to create a scaled bitmap

BitmapDrawable contactPicDrawable = (BitmapDrawable) ContactsUtils.getContactPic(mContext, contactId);
Bitmap contactPic = contactPicDrawable.getBitmap();

Resources res = mContext.getResources();
int height = (int) res.getDimension(android.R.dimen.notification_large_icon_height);
int width = (int) res.getDimension(android.R.dimen.notification_large_icon_width);
contactPic = Bitmap.createScaledBitmap(contactPic, width, height, false); 

And then I set the large icon with this scaled bitamp.