Event handling for button
I have created a button. Now I want to do:
- A single click of a button will open a dialog.
- Double click of a button will open a dial pad.
- OnLongtouchpress of buttons I want to change开发者_StackOverflow社区 the color of the button.
Now in my case, I have used a single click event. So I want to know is there any option for double click and onlongtouchpress event on the same button if so, please suggest to me. With examples, if it is possible.
Regards Anshuman
Use button.setOnLongClickListener
to handle onLongclick event
For double click event See the followig URL
http://mobile.tutsplus.com/tutorials/android/android-gesture/
You need to set specify listeners.
Button btn = (Button)findVieByID(R.id.button1);
btn.setOnClickListener(.....);
btn.setOnLongClickListener(.....);
setOnDoubleTapListener not existing for Button
精彩评论