Using custom drawables in an Android Notification
Is there any way to use an image that I'm generating on the fly as a Notification icon?
Asked by: Arthur722 | Posted: 20-01-2022
Answer 1
This topic was discussed in a previous SO question. Upshot: I don't think it is possible.
UPDATE: For tablets or other large-screen devices, on API Level 11+, there is a largeIcon
property which accepts a Bitmap
. AFAIK, this is unused on smaller-screen devices, such as phones.
Answer 2
You can now change the main icon with API 11 (Notification.Builder -> setLargeIcon)
Answered by: Arnold728 | Posted: 21-02-2022Answer 3
Try creating a custom Notifications view, then you should be able to use a Bitmap object:
RemoteViews contentView = new RemoteViews(context.getPackageName(), R.layout.custom_notification_layout);
contentView.setImageViewBitmap(R.id.icon_view, myBitmapObject);
notification.contentView = contentView;
For more info see "Creating a Custom Expanded View" on this page: https://developer.android.com/guide/topics/ui/notifiers/notifications.html
Answered by: Chelsea429 | Posted: 21-02-2022Similar questions
How to use an icon from Android's Drawables as a notification icon?
Android Drawables is a site that lists a lot of built-in icons available for Android.
If I wanted to use one of them, for example emo_im_angel, as a notification icon, how might I do it?
For example:
NotificationCompat.Builder mB...
android - Status bar notification with sound doing call
I'm doing an app that need to notify the user doing a call that the call is taking to long...
I got every thing up an running and an the notification is made at the right time (I can see it at the status bar) but with no sound. If I make the notification call when there is no call the sound is played.
My notification looks like this:
NotificationManager mNotificationManager = (NotificationM...
Notification on new Email with Android
is there a way for an app to get notified when a new email has been received? My goal is, to rise an alert (play a sound, vibrate, whatever) if an email with a specific topic gets received (think of it like an "filter" or a "rule"), but I dont want to check the email server by myself. I think I'm searching for something like "android.telephony.PhoneStateListener" but for Email.
Android: Looking for an easy way to play notification sounds in a loop manually
I am fiddling around with a dialog that pops up and displays an alarm information. (I know, it has been documented that in Android it's "better" style to use notifications instead, but just like the alarm clock I want it to display a dialog on top of whatever you do to really get the users immediate attention - as the user expects this behavior I don't think it's bad style!)
Now - the only easy way I found is using...
android - Is there any way to receive a notification when the user powers off the device?
I need to know when the user powers off his/her phone. Are there any broadcasts (or similar) that notify when the user's phone is powered off?
android - Notification question
I want to show a notification when a call is active.
I have done the first easy part. Notification starts when my call intent starts.
Now to the tricky part, how can I tell my Notification that the call has ended?
java - resuming an activity from a notification
I have a notification in the status bar for my app:
Notification notification = new Notification(R.drawable.icon, null, System.currentTimeMillis());
Intent notificationIntent = new Intent(this.parent, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this.parent, 0, notificationIntent, 0);
...
notification.flags = Notification.FLAG_ONGOING_EVENT;
...
android - Changing notification settings in native email app
Is there a way to change notification settings in the native email app (possibly also gmail)?
I'm thinking about locale plugin which would allow to change notification settings in each app independently. For example disable sound notifications in email app and leave in gmail...
Close activity via click on Android notification list
I'm looking to find out how to stop an activity instead of resuming upon the click of the item on the notification list. Any ideas?
java - How to create notification icon badge on Android apps (like iPhone)
I am very new to programming and would like to know what is the best way to go about creating a notification icon badge similar to the ones on the iPhone apps. This would be basically for creating a badge for the notifications that end up in the notification bar.
android - Disable the ability to drag down the notification bar
I am doing an android applicaiton and I know its possible to show or hide the notification bar.
but is there a way to show it but Disable the ability to drag it down?
Thanks
Still can't find your answer? Check out these communities...
Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android