That sounds like normal, expected behavior.  A touch screen is a very analog
device -- the position never remains constant, and no matter how still you
try to hold your finger, there are slight changes in the position that will
be seen.

You just need to do correct touch tracking: define the region where the
touch is allowed, and consider a down in that area to be the start of a
touch and any continued events within that area to be the same continued
touch.  You should also consider allowing the finger to drag outside of the
touch area and continue to be counted as a touch in that area, since it is
easy to move the finger a fair amount when releasing and even if it goes
outside of the hit region the user probably still intended for that to be a
touch (not a cancel of their press).

The platform does ensure that you will get a final up event when you receive
a down, so ultimately it is up to you to implement the position tracking in
a way that provides the reaction you want.

On Tue, Jul 20, 2010 at 11:50 PM, billconan <billco...@gmail.com> wrote:

> Hello everyone.
>
> I'm working on a simple game: when you press a button on the screen, a
> character will run to certain direction.
>
> it's easy to support keyboard input. but, some phone doesn't go with a
> keyboard or even no a track ball. so I decided to draw a virtual "run"
> key on the screen (with opengl). when the user press the virtual key,
> i apply a velocity to the character. and when the user release the
> key, i disable the velocity to stop the character.
>
> but there seems to be some touch event noisy.
>
> if my finger cannot press still, i will see millions of touch down and
> touch up events, instead of a single long pressing. and occasionally,
> my program captured the touch down  event when i touch the screen, but
> didn't capture touch up event. so my character will keep moving, even
> no finger is on the screen.
>
> I'm wondering if there is some way to reduce the touch event noisy and
> tell if the user is currently pressing on the screen, instead of only
> getting an event when touch up and down happen.
>
> it seems the system ui can detect long pressing, for example when you
> put a finger on one item of the list view widget, the entire item
> turns to orange.
>
> i just don't know how to detect pressing in my opengl game.
>
> thanks.
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
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