As far as I know we can create notifications in Android using Notification Manager + remote Views.
I am Creating a notification for downloading Mp3 files. And I want an animations beside It. So far I have learned from forums that it is not possible.
However I saw A video for an android App which downloads and displays animation beside it while downloading it. Link: http://www.youtube.com/watch?v=yNcs-sS2nFU&feature=related
Can someone tell me the best way to achieve it.
In the documentation for creating status bar notifications, it says you can cycle through a bunch of images that are defined in a
LevelListDrawable
by changing theiconLevel
property of the theNotification
class:The best way I have found to show a custom animation in a notification is to use an AnimationDrawable as a resource with an ID. Then simply specify the drawable resource ID when you post your notification. No further code is needed to update each frame of the animation. The animation drawable handles that for you.
Here is a link to documentation: http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html
So for example you would need to:
Add an xml file (such as "wheelAnim.xml") to your res/drawable/ folder with the following contents:
Add each drawable reference in the xml file you just created for the animation-list (be it PNG or other image format) in the
res/drawable/
folder as well.Use the resource ID of the animation-list (which in this example is "R.drawable.wheelAnim") in your code. For example: