[android-developers] Re: Need to optimize some graphics calls.

2010-10-14 Thread Andy
HI Joel, drawing in a Canvas can be difficult from a performance approach. You can speed things up, here are only a few sidenotes you can check: * Do you preload Images * Which format are you using (ARGB , ARGB or RGB565) : need Alpha ? * Are you allocating memory in you loop * Do you

[android-developers] Re: Need to optimize some graphics calls.

2010-10-14 Thread niko20
If you are looping over an ArrayList then according to benchmarks, it's faster to grab the ArrayList length and store it before looping rather than doing something like ArrayList.length() every iteration, so check for that too. -niko On Oct 14, 3:00 am, Andy m...@tekx.de wrote: HI Joel,

[android-developers] Re: Need to optimize some graphics calls.

2010-10-14 Thread niko20
Here's a small way that I was able to improve my drawing in a app I have where I do lots of canvas calls. I also use an ArrayList. This is the code in my onDraw(): temparray = trackEvents.toArray(); int tracksize = trackEvents.size(); if ((trackEvents != null)