I'm trying to set a background on a notfication on Android wear however I get the error
setBackground in android.support.v4.app.NotificationCompat.WearableExtender cannot be applied to (int)
I've been trying to figure it out for a while but I'm stumped.
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Code Received")
.setContentText("Your Orange Wednesday code is " + orangeCode)
.extend(new NotificationCompat.WearableExtender().setBackground(R.drawable.orangebg));
If anyone is able to point me in the right direction, that would be appreciated. Thanks
As can be seen in the documentation the method needs a bitmap as input.
https://developer.android.com/reference/android/support/v4/app/NotificationCompat.WearableExtender.html#setBackground(android.graphics.Bitmap)
public NotificationCompat.WearableExtender setBackground (Bitmap background)
Set a background image to be displayed behind the notification content. Contrary to the NotificationCompat.BigPictureStyle, this background will work with any notification style.
Parameters
background - the background bitmap
R.drawable.XXX is an integer identifier for the framework to find your physical asset. Use BitmapFactory.decodeResource(context.getResources(), R.drawable.XXX)
to retrieve the bitmap from your assets and apply it later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With