At JAXConf, Romain Guy did say that instantiating Paint is a surprisingly CPU intensive operation. So yes, that should certainly be taken out of the for loop. The suggestion of taking out doubleParse() is a good one, too.
On Jun 28, 5:33 pm, JP <[email protected]> wrote: > On Jun 27, 7:32 am, Boozel <[email protected]> wrote: > > > Can any one tell me what the best structure is to do the drawing and prevent > > this? > > Your draw() routine is inefficient, and you really get hit in the ...> constrained mobile environment. Here's a few changes that I would try: > - Pull object instantiations out of the draw() routine, especially out > of the for() loop. For example, create the Paint() instance in > onCreate() > - Have all data readily available, e.g. do not Double.parseDouble() in > draw() > - If the above doesn't help: Depending on how many rows you have, > you'll need to break this up in multiple calls to draw() from the > event loop. I cannot remember offhand how to do this in Anrdoid, but > the classic method for systems like Motif or Qt is to break these > loops down into small atomic events, and create an event for each > atomic step of drawing a row, parsing content etc. until you're done > drawing or processing content. > JP -- 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

