Thanks Robert,

I'll have to play around with this idea and see what works.

- Mike

On Sep 9, 1:07 pm, Robert Green <rbgrn....@gmail.com> wrote:
> Mike, here's something to try:
>
> When handling motion events, process all of the historical data in
> order as if it's receiving those events like normal,
> then:  Sleep 16 or 32 ms or so.  You'll still receive all of the
> important stuff as historical data but you won't be flooded with
> events.  You'll be effectively limiting the number of events that can
> come in to 60 or 30 per second.  If you run another thread that
> animates or does anything graphically, you'll notice that because of
> the little bit of sleep on the UI thread, your game thread will
> continue running smoothly instead of getting chopped up from having to
> share so much CPU.
>
> I'm not sure if Dianne would recommend sleeping like that, but it was
> recommended by a speaker at Google IO for game performance and my
> tests showed that it is very helpful in situations where moving-touch
> processing is causing lags.
>
> On Sep 9, 12:03 pm, Mike <michaeldouglaskra...@gmail.com> wrote:
>
> > Thanks Dianne!
>
> > That might explain why, if I swipe my finger quickly over 3 or more
> > letters, that it sometimes won't register the ones in the middle.  I
> > will have a look at making use of the historical points to see if that
> > helps fix the problem.
>
> > Regards,
>
> > - Mike
>
> > On Sep 9, 10:08 am, Dianne Hackborn <hack...@android.com> wrote:
>
> > > Another thing you should probably consider -- the MotionEvent may contain
> > > more than one movement, as part of the historical data.  So, especially if
> > > you have a little overhead in handling events, if someone moves their 
> > > finger
> > > quickly you may get a single motion event with some historical points 
> > > inside
> > > of a box but the final one outside.
>
> > > On Wed, Sep 9, 2009 at 8:42 AM, Mike <michaeldouglaskra...@gmail.com> 
> > > wrote:
>
> > > > Hey there.  I wanted to follow up and say that I haven't heard back
> > > > from any of my users that have the myTouch and toggling/turning off
> > > > the location services to see if it made a difference.
>
> > > > However, I came across something in my code which may be at least part
> > > > of the problem.  In WordUp! the user spells out words by tracing their
> > > > finger across the letters which are arranged on a square grid.
>
> > > > I handle onTouchEvent(MotionEvent event) calls to my view to determine
> > > > when the user first starts selecting, when they are dragging their
> > > > finger, and when the let up to do the appropriate drawing and
> > > > recording of letters during this gesture.
>
> > > > One thing I had not taken into consideration is the large number of
> > > > onTouchEvent calls I would get while the user is moving their finger
> > > > while it is pressed down.  I only needed to care about when their
> > > > finger enters the bounds of a new cube, and record and invalidate a
> > > > dirty rect to redraw that portion of the screen.  However, I was doing
> > > > this work on every call to onTouchEvent which was invalidating my
> > > > dirty rect many more times than it needed to.
>
> > > > Once I accounted for this, the drag gesture is a lot more responsive.
> > > > I haven't confirmed that this fix addresses the lag issues people have
> > > > seen using my game on the myTouch, but I'm very curious to find out.
>
> > > > Regards,
>
> > > > - Mike
>
> > > > On Aug 27, 1:22 pm, Mike <michaeldouglaskra...@gmail.com> wrote:
> > > > > Thanks everyone for your input.  I'm asking some of my users to do
> > > > > what Dianne suggested with toggling the location services off and on
> > > > > to see if that is enough to alleviate this problem.  I'll let you know
> > > > > what I find out.
>
> > > > > Regards,
>
> > > > > - Mike
>
> > > > > On Aug 27, 1:20 pm, Hong <lordh...@gmail.com> wrote:
>
> > > > > > Thanks for the clarification!
>
> > > > > > On Thu, Aug 27, 2009 at 3:03 PM, Dianne Hackborn 
> > > > > > <hack...@android.com
> > > > >wrote:
>
> > > > > > > Next feature release.  I don't know what announcements have been 
> > > > > > > made
> > > > about
> > > > > > > it, so I'm not in a position to say anything.
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > hack...@android.com
>
> > > 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to