Try googling "debounce".
On Feb 7, 2012 6:19 AM, "cellurl" <gpscru...@gmail.com> wrote:

> I tap the screen and it registers multiple-taps.
>
> It didn't do that on the emulator, but on a G1, if I tap once, it
> fires multiple times.
>
> Q: How do I get rid of the double taps?
>
> Thanks in advance!
> -cellurl
>
> ---------code-------
>
>
> public class JetBoy extends Activity implements View.OnClickListener {
>
>
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        setContentView(R.layout.main);
>
>        final View touchView = findViewById(R.id.touchView);
>
>        mTouchView= ((TextView)touchView);
>
>        mTouchView.setText("");
>
>
>        touchView.setOnTouchListener(new View.OnTouchListener()
> {
>            @Override
>            public boolean onTouch(View v, MotionEvent event) {
>
>                Log.d("TAGGG","onTouch
> " );
>
>
>                //see if we tapped on the right or left side of screen
>                boolean right=false;
>                if(event.getX() > Global.mCanvasWidth/2) {
>                    right= true;
>                }
>
>                //ignore ACTION_UP, just RETURN HERE
>                if(event.getAction() == 0x00000001) {
>                    Log.d("TAGGG","Action_UP");
>                    return true;    //get rid of double hits from DOWN
> and UP. I couldnt get ACTION_UP so I used hex
>                }
>
>                return true;
>            }
>        });
>    }
>
>
> --
> 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

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