Posting a message won't cause a stack overflow -- messages aren't handled until you return back to the main message loop.
On Fri, Apr 8, 2011 at 8:51 PM, Numeron <[email protected]> wrote: > Sorry for above post, I hit the wrong button... > > > > > On Saturday, April 9, 2011 1:18:09 PM UTC+9:30, Numeron wrote: > >> >> >> On Saturday, April 9, 2011 1:53:36 AM UTC+9:30, Dianne Hackborn wrote: >> >>> On Fri, Apr 8, 2011 at 1:16 AM, Numeron <[email protected]> wrote: >>> >>>> I wouldnt have thought it would work like a busy method if its adding >>>> itself to something like an event queue or whatever, but I'll take your >>>> word >>>> on it. >>>> >>> >>> Well it is going to continually execute messages, even if it isn't >>> needed. That is, if it takes you 10ms to draw a frame and the frame rate is >>> 60Hz (20ms between frames), you should be using 50% of the CPU. But with >>> your code you will consume all of the rest of the CPU dispatching these >>> messages for no reason. >>> >> > I think I understand now, Invalidate() doesnt draw as I thought it did, it > simply... well duh, Invalidates... This makes much more sense now. I think > reposting the handler at anything less than the framerate then will > eventually cause stack overflow if im not mistaken, so should always then be > called from the onDraw() method. I will do this. > > >> Having said that Im pretty sure that your suggestion to invalidate() at >>>> the end of onDraw() would turn out to be busy too. >>>> >>> >>> Drawing is throttled to the frame rate. >>> >>> -- >>> Dianne Hackborn >>> Android framework engineer >>> [email protected] >>> >>> Note: please don't send private questions to me, as I don't have time to >>> provide private support, and so won't reply to such e-mails. All such >>> questions should be posted on public forums, where I and others can see and >>> answer them. >>> >>> -- > 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 > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

