Okay, so this is probably more than you need and may not fit into exactly what you are doing. But I was hacking around since the post were you said you weren't using buttons, and I thought 'if this were me, I would have my own class to help encapsulate the 'button' concept, even if it is not the Android Button.' So I made this:
Now, for this case, I think the only part that is necessary is the fact that there is a
public boolean isEventInbounds(int x, int y) method which you can call to check if that button is pressed. I then modified my first bit of code snippet to use this class:
Then I did some other modifications of my original code:
1) I added a Map to track the Pointer IDs and what button they were last pushing
2) some methods for encapsulating the effects of left/right buttons
3) the OnTouch() method which determines what to do.
For #1, and #2, and #3 before adding the MOVE action, I had this code:
Lots of code, but the important part is that the handleRightButtonPush() and handleLeftButtonPush() take care of the DOWN and UP actions for each button, delegating to rightButtonUp() rightButtonDown(), leftButtonUp, rightButtonDown() as needed, and the ddddButtonUp/Down() methods take care of adding and removing pointers from the map.
So we have a Map<Integer, Button> which has all the Pointer IDs we care about, and what button they were last associated with. Now we get a MOVE action and need to:
1) Figure out where each pointer is located.
2) Figure out if a pointer left its last known location, and if so register that fact.
3) Figure out if a Pointer entered a new Button location, and if so, register that fact.
To do this, I thought I would have to account for pointers which where down, but not over one of the buttons. So I added the following code to track a 'NONE' button. Basically the same stuff as for the left and right buttons:
Now, I have something to put in the Map so I don't lose track of wandering pointers. Finally I can add MOVE to my onTouch method:
So the first half of the method determines if it is a MOVE action. If it is, we will handle it here. If not, then we will delegate to the handleddddButtonPush() methods, like before (but this time, also adding the NONE button push).
In the MOVE section of the method, I iterate all the pointers in the Map - the Map must contain all and only the Pointers I care about since I add/remove them whenever a DOWN/UP action occurs. So I iterate over each one, get its last known button, and check if it still sits on the same button. If it does, no further action is needed. If it does not, I check which button it does sit on and make it do that button's action.
None of the is compiled or tested, so take it as a little more than pseudo code. Also note that I think the way I handle the map in the iterator may lead to a ConcurrentModificationException, but I will let you handle that if it happens.
And like I said, this is so much different than what you have you may just want to take the Map or List idea and ignore 90% of the code
