7 Jun 2008 01:56
Re: onTouchEvent triggered three times when I click on the screen only once
hackbod <hackbod <at> gmail.com>
2008-06-06 23:56:46 GMT
2008-06-06 23:56:46 GMT
Down, move, up. Look at the action code in the event to see which of
these actions is happening.
On Jun 6, 4:39 pm, Neo <wang.liang.... <at> gmail.com> wrote:
> I didn't double confirm if it does trigger three times by creating a
> plain simple view yet. Below is my code. Now I add a timer so that
> the program just ignore the following trigger in 2 seconds.
>
> Has anybody encountered this problem before?
>
> private Date oldDate = new Date();
> <at> Override
> public boolean onTouchEvent(MotionEvent event) {
>
> //I don't know why it just trigger onTouchEvent three times every
> time I click on the screen
> //so, now I change the program don't response to continuous quick
> touches (if they are)
> //maybe I coded somewhere wrong that triggers 3 times events.
> Date now = new Date();
> if (now.getTime() - oldDate.getTime() > 2000){
> oldDate = now;
> } else {
> return true;
> }
>
> ClassicCard c = null;
> Point p = new Point ((int)event.getX(), (int)event.getY());
>
(Continue reading)
RSS Feed