I have written a small tutorial for this and have been told it's helpful: http://developingthedream.blogspot.com/2011/01/android-canvas-frame-by-frame-animation.html
On Sun, Aug 28, 2011 at 8:38 AM, blake <[email protected]> wrote: > Have a look at android.graphics.drawable.AnimationDrawable. You might > be able to use it... though it's a bit limited. > > It isn't clear what you are actually trying to accomplish. I suspect > that you are trying to optimize repainting the screen. Is this just a > vague worry or is there something, in particular, that is running to > slowly? > > The answer to your question is that it is always the onDraw method > that gets called, when you need to redraw the view. I'd guess that > you will set up an animation thread to redraw the view. That thread > will, probably, update the position of the 2nd image but not the > first, and then request a repaint. That will generate a call to > onDraw. > > You can make onDraw as clever is is necessary. If your scene is > expensive to compute and only the 2nd image moves, you might be able > to cache the first as a bitMap. From what I've been hearing, though, > that won't necessarily speed things up, post Honeycomb, because of the > way it optimizes drawing. > > ... and, of course, there's OpenGL. > > -blake > > > > .... if not, though, you'll probably need to spawn an animator thread, > that redraws your view after > > On Aug 28, 6:31 am, "A. Purohit" <[email protected]> wrote: >> Hi, >> How do we display a moving image in Android? >> For example, I have 2 images, first one covers the full screen, 2nd one >> which is transparent and small will be moving. >> >> So, first I show bigger one to cover complete screen then show 2nd one but >> now I want to move 2nd one so that it shows moving thing. >> >> I am reading docs on this but couldn't control my self! >> >> Do we have option to keep first one as it is and some move option for 2nd >> bitmap? Or we display both once again with just changing x,y for 2nd one? >> >> Do we have the first option? >> >> Thanks, >> -A > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- ~ Jeremiah:9:23-24 Android 2D MMORPG: http://solrpg.com/, http://www.youtube.com/user/revoltingx -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

