For example,i have form with 2 buttons. I click on button1,and after click on button2 with another finger.How to create event for button2 and get second touch coordinate?
Asked
Active
Viewed 680 times
2 Answers
0
If you touch button 2 while keeping button 1 pressed, button 2 will not get any event.
Check http://developer.android.com/reference/android/view/View.OnTouchListener.html You should attach onTouchListener to button 1, and for each ACTION_POINTER_DOWN in the motion event, check that the x and y coordinates are inside button 2 bounds.

Painless
- 176
- 4
-
How to do this in Rad Studio XE5?There are no such functions:( – user2779778 Sep 14 '13 at 18:33
0
It may be useful to query the Android developer website to see the implementation of the touch method http://developer.android.com/reference/android/view/View.OnTouchListener.html
The setOnTouchListener is similar to the setOnClickListener in the way it is used.Here is a code example:
imageButton.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_UP){
// Do what you want
return true;
}
return false;
}
});

Brian Var
- 6,029
- 25
- 114
- 212