Hi.. I tried the idea u gave for testing purpose..and It worked fine..I was able to get the location and co-ordinates..and yes as u said onTouch will be invoked only for one view which touched..but I'm trying to use this ACTION_POINTER_DOWN and this stuff of x and y co-ordinates..so that I could implement Multitouch..
I request any one of you to guide me on Multitouch,since all the resources I found on google didn't work for me atleast..relevant response will be very much appreciated. Thanks On Wed, May 2, 2012 at 5:45 PM, Jason Teagle <[email protected]> wrote: > OK, a little experiment on my part has yielded the following information. > > > Also, I'm a little confused - the prototype for the onTouch() method >> includes a View object - the view that received the event. Why do you need >> to find the view that was touched when it is being *given* to you in the >> handler? >> >> As far as I know (my Android experience is very limited, so someone may >> be able to correct me here), events are only dispatched to the widget / >> view that they occur on, >> > > I can confirm that events, including onTouch(), do *not* go to any view > *other* than the one on which the handler was set. Therefore, the View > passed in onTouch() *is* the view that received the event - the button, in > your case. > > > > 3.Single pointer (i.e just ACTION_DOWN)also doesn't identify the view. >> > > OK, the documentation is the problem here - it is not good enough. When I > read the details against getX(), it has AXIS_X as a 'See also', and when > you go there, it says co-ordinates are given in screen co-ordinates. For > getX() and getY(), however, this is *incorrect*. Whether it is correct for > AXIS_X I don't know or care, but for the onTouch event and getX() and > getY() purposes, the values from those two functions are *relative* to the > top-left of the view's (button's) client area - in other words if you > touched at exactly the top-left corner, it would give 0, 0 - if you touched > exactly at the bottom-right corner, it would give (width - 1, height - 1). > > Thus, your test is not really needed, since the correct view is passed to > you - and even if you wanted to find the view yourself, you can't since you > are being given relative client co-ordinates, not screen co-ordinates. You > can't even convert those values to screen since you'd need to know which > view they are relative to in the first place to be able to convert them! > > Hopefully that helps. > > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to > android-developers@**googlegroups.com<[email protected]> > To unsubscribe from this group, send email to > android-developers+**[email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> > -- 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

