You should be concerned with much more than having the ANR dialog. The ANR dialog happens after *5 seconds*. That is an insanely long amount of time, well into the broken range. 200ms is a very long time for normal things on the UI thread -- that is well into the territory of causing obvious glitches and laggy response in the UI.
On Wed, Aug 31, 2011 at 10:18 AM, Dmitry Golubovsky <[email protected]>wrote: > Dianne, > > Thanks for your quick reply. > > On Aug 31, 12:28 pm, Dianne Hackborn <[email protected]> wrote: > > On Wed, Aug 31, 2011 at 9:16 AM, Dmitry Golubovsky <[email protected] > >wrote: > > > > > Q1: Is post(action) equivalent to postDelayed(action, 0)? > > > > Yes. > > OK, may I suggest that this be reflected in the reference? > > > > > what combinations of N and T ranges (including T = 0) are acceptable > > > to make sure the view remains responsive to touch and other user- > > > generated events, and "force close/wait" dialog does not appear? > > > > It will remain responsive because older messages are processes before > newer > > messages, so you can't starve other messages from the queue by re-posting > a > > message when you handle it, even with no delay. > > OK, so there are no specific priorities on user-generated vs. posted > events. > > > the user is in your app, if using a delay of 20ms means you are keeping > the > > CPU running at near 100%, are going to much more quickly drain the > battery > > (and the user will see this in the battery use report). > > I posted much simplified code. This is the same Smalltalk VM port that > I mentioned several times in the NDK group. > > The VM has an interval timer (which is N in my example), and when it > expires inside the native code, the VM saves its state and returns to > the Java UI code. Or otherwise it may return if there is nothing to > process (no input events). If return happened by timer, the VM will be > reentered ASAP (that is, after T in my example). Otherwise it may not > be reentered until another user event is registered. That is, zero-or- > near-delays between entering native code do not happen 100% of the > time. > > All I am concerned about is not to have the "non-responding" dialog > and buffer pending events within the application. > > Your explanation is very helpful. > > Thanks again. > > -- > 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

