"Decision No. 2 (dynamic)" in this question / answer:
overlay two images in android to set image
very close to what I want to do, namely, dynamically create a list of layers (for the notification icon in the status bar, I want to create my own icon in the layers), but the purpose of the icons in the notification API requires the resource identifier (which I want to call from the service) .
I cannot figure out how to create a dynamic assembly of a list of layers without creating hundreds of XML files with a single layer (for various icon combinations that I would like to display). Daniel "Solution # 1" works great for static .xml files, but I'm looking for a more elegant dynamic solution.
In the above message, the code snippet:
Resources r = getResources(); Drawable[] layers = new Drawable[2]; layers[0] = r.getDrawable(R.drawable.t); layers[1] = r.getDrawable(R.drawable.tt); LayerDrawable layerDrawable = new LayerDrawable(layers);
it looks like what I want, but I donβt know and donβt understand how to βassignβ a new layerDrawable to my notification icon (which accepts the resource identifier).
Thanks to everyone ... stackoverflow is a great resource!
source share