this is the code
Thank you.
1. Question: What is 'left' as used here:
---
if(location1[0] <= x && x <= (location1[0] + left.getWidth()) &&
location1[1] <= y && y <= (location1[1] + left.getHeight())) {
return touchedView1;
}
---
I assume it is the view itself, but since you appear to be allowing for
multiple views, I would like to see where 'left' is declared and set -
especially as you refer to the view itself as 'touchedView1'.
2. I would recommend the following change to code to make it a little easier
to read and understand:
Rect viewBounds = new Rect(location1[0], location1[1],
location1[0] + touchedView1.getWidth(),
location1[1] + touchedView1.getHeight() );
if (viewBounds.contains(x, y) )
return touchedView1 ;
(or use left.getWidth() and left.getHeight(), if that is more appropriate)
3. If you only touch the screen with one finger, does it then work
correctly? It would be worth testing with one pointer only to begin with,
rather than complicate things.
4. It might be worth gathering the X and Y of all pointers and the screen
locations and dimensions of all views you are allowing for, and just sanity
check them to see if there is anything unusual. For example, do you get the
same number of pointers as fingers that are touching the screen, or does it
appear to return more? The one with the negative values is the one to
watch - don't just negate the values, that in itself represents a problem
and you need to understand why. So try your code as-is for one finger first
and check that works for various locations. Assuming that works, then try
two fingers and just touch the screen (don't try gestures at this point) at
various points and see if the list of X / Y and locations you get make
sense.
Let us know the results.
--
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