If you haven't tried already:
1. Replace the strings that get modified with char[]. Strings are immutable
objects so changing one means memory allocation and leaking.
2. Also check the Allocation Tracker for memory leaking.
3. For the constant strings I would use Picture or some bitmap buffer
mechanism to store the drawn text and then just place it on the Canvas
without overhead.

On Wed, Aug 26, 2009 at 12:24 PM, CG <[email protected]> wrote:

>
> Hi, I am creating an app that show some histograms off your traveling
> speed in different time periods (histogram for the last minutte,
> histogram for the last 2 minuttes etc.)
>
> I would like to have an animation, and have discovered that drawing
> everything takes arround 300-400ms. wich is to long for making my
> animation smooth, the animation itself is quite simple (2 lines and 2
> dots).
>
> What i draw every frame right now is
> 20 antialised strings, size 14,  in average ~5chars
> 8 of these strings will change every second.
> 1 of the string will change with the animation (this will become 5
> strings if there is time)
>
> the main part of the screen, the one showing the histogram data,
> consist of a lots of squares wich needs to be updated every second.
> (450 squares)
>
> the presentation is split into 5 frames in the same view (has to be
> same view as arrows in one frame might point into another frame)
>
> invalidating only a part off the screen makes almost no difference (it
> does becomas a bit faster, but i still execute all my drawing stuff).
> I have tried to add a flag wheter or not the main part is dirty, but
> if i don't draw it, it is cleared. I might be missing something
> here...
>
> One possibility could be to render all the mostly static stuff to a
> bitmap, and then simply draw the bitmap.
> that would mean 10 strings only had to rendered on orientation change.
>
> I think it would make sence since the slowest rutine is the one
> drawing all the text. (the following is a typical timing for the
> drawing rutines, accmulated).
>
> V/HMMULTIBAR(  352): 0 - Drawing time: 0 ms
> V/HMMULTIBAR(  352): 1 - Drawing time: 53 ms
> V/HMMULTIBAR(  352): 2 - Drawing time: 62 ms
> V/HMMULTIBAR(  352): 3 - Drawing time: 85 ms
> V/HMMULTIBAR(  352): 4 - Drawing time: 280 ms
> V/HMMULTIBAR(  352): 5 - Drawing time: 303 ms
>
> I would really appreciate comments about wheter or not offscreen
> rendering is the way to go, or if there is a simpler way.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to