Hi,
It is expected that two MotionEvents will be generated...
First :         ACTION_DOWN
Second: ACTION_UP

You can determine which event has occurred using getAction() method.
//===========================
        @Override
        public boolean onTouch(View v, MotionEvent event) {

                switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:

                        break;

                case MotionEvent.ACTION_UP:

                        break;

                default:
                        break;
                }

                return false;
        }
//=============================================


By the way, if this is a button and you are not planning for something
special, you can use OnClickListener instead of OnTouchListener.
If you use OnClickListener, then one click event will be generated per
touch. And, also, you can activate the button from keypad also.


Regards
Sarwar Erfan


On Aug 4, 12:06 am, Manish Sharma <[email protected]>
wrote:
> Hi All,
>
> I am facing  a problem. I have implemented a touchlistener. i touch
> the button once but the listener is invoked twice.
> Please suggest.
>
> Thanks in advance.
> Manish Sharma

-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to