It works. I just need to check if it is DOWN action and ignore other
actions. I thought DOWN action meant moving down, but actually it is
like onKeyDown. Thanks!
I am just curious why the API doesn't uniform event model. Like
onKeyDown and onKeyUp, why not provide onTouchDownEvent,
onTouchMoveEvent, and onTouchUpEvent?
On Jun 6, 4:56 pm, hackbod <[EMAIL PROTECTED]> wrote:
> 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 <[EMAIL PROTECTED]> 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();
> > @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());
>
> > if( deck.contains( p ) )
> > getNewCards();
>
> > this.invalidate();
>
> > 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 [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---