views:

327

answers:

1

Hi folks.

I'm try to use a remote URL (like a favicon) for a Notification Icon, however the Constructor for a Notification only accepts a resource id (which is an int), as opposed to something sensical like a FileInputStream. How can I either, define at runtime a new resource id for a stream source, or download an icon to my resources and then dynamically get a resource id?

+2  A: 

You can't do this in Android currently, because resources can only be loaded from the /res/ directory of your APK. See Resources and Internationalization. The /res/ directory is built when you create your APK and can't be changed after.

Do you expect your Icon to change often enough that you need to query a URL to ensure it is up to date every time you send a notification?

Most applications that need to change their icon would simply put an update out on the Android market.

Dinedal
Yeah that's not really an option. I'm doing a client for http://notify.io and a notification can specify it's own icon. Could I possibly overwrite a raw resource? (my initial tests say I cannot, I can only read)
Ben
No, you cannot overwrite a raw resource. At present, it is not possible to create Notification icons on the fly.
CommonsWare
That site looks like Growl for the web, pretty neat.However, it looks like you are stuck with picking a generic Notification icon and using the text to tell the user what application supplied the information.
Dinedal