I wrote an app that does something similar: full screen redraws while the user scrolls. It took some effort, but it's pretty fast now.
Have you profiled your code? Profile on a device rather than in the emulator as the graphics performance differs significantly. Also profile your memory usage during animation, and try to reduce the number of allocations to zero. I don't know how complex your foreground is, but if does not cover much of your background you might consider repairing where the foreground changes instead of redrawing the entire screen. Craig. On Jul 22, 7:11 pm, doubleslash <doublesl...@gmail.com> wrote: > Those are nice general pearls of wisdom, but I still don't know how to > fix the problem. > > I have a thread updating the physics, and the foreground image will > change accordingly. I also have another thread drawing onto the > surfaceview. At the moment it seems highly inefficient as I'm drawing > in addition the the updated foreground, the same constant background > on to the canvas every step of the animation. I cannot put the > background image into another view because either it will block the > surfaceview or be blocked by it. > > Do I have to live with this, or there's a better way? > Thanks > > On Jul 22, 9:13 am, Jason Van Anden <jason.van.an...@gmail.com> wrote: > > > I found the presentation super helpful as well ... after you watch it tho, > > refer to this ... > > >http://developer.android.com/guide/practices/design/performance.html > > > It covers most of the important points he makes. > > > Jason Van Andenhttp://www.smileproject.com > > > On Wed, Jul 22, 2009 at 12:03 PM, Roman > > <roman.baumgaert...@t-mobile.com>wrote: > > > > You can find some useful information in the following presentation. > > > >http://code.google.com/events/io/sessions/WritingRealTimeGamesAndroid... > > > > You can skip the first 10-15 min .... > > > > -- > > > Roman Baumgaertner > > > Sr. SW Engineer-OSDC > > > ·T· · ·Mobile· stick together > > > The views, opinions and statements in this email are those of the > > > author solely in their individual capacity, and do not necessarily > > > represent those of T-Mobile USA, Inc. > > > > On Jul 21, 9:57 pm, peeyush varshney <varshney.peey...@gmail.com> > > > wrote: > > > > Hi, > > > > How to free the memory created by Animation..... > > > > > On Tue, Jul 21, 2009 at 10:25 PM, doubleslash <doublesl...@gmail.com> > > > wrote: > > > > > > I have a static background image, and a foreground that needs to be > > > > > animated. I tried a couple different approaches but the animation > > > > > seemed choppy. > > > > > > One thing I did was having 2 different views, constantly calling > > > > > invalidate() on the foreground view. Another was to have only 1 > > > > > surfaceview, redrawing the background image and the foreground on each > > > > > step of the animation. While a surfaceview offers an optimal way to do > > > > > heavy-duty animation, having to redraw the background every time kills > > > > > the performance. Neither produced a smooth animation. > > > > > > What is the best way to perform this kind of animation--static > > > > > background and animated foreground? > > > > > > Many thanks. > > > > > -- > > > > Thank & Regards > > > > Peeyush Varshney --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---