Looking at the documentation, the touch major and touch minor are axis of the ellipse for the touch event. one is for the length of the touch area longest measurement and the other for the shortest of the touch event. like the measurement of an ellipse.
however, i tested this code for getTouchMajor and getTouchMinor methods on several android tablets. and did this with putting my finger down so that the surface area touching the screen would be longer in one direction so it would not be a circle. this way the max and min numbers should not be the same.
the problem is that no matter what shape the area that is touching the screen in the on touch down event, it always is the exact same float number for both. the only way for this to be possible is if the finger skin area touching the screen is a circle.
so basically, the two android tablets I have treat the touch event area of touch as a circle shaped area, sometimes larger or smaller, however always makes it circle shaped, is there any device out there that gives you a more accurate shape?
the only good information I get from these functions is the general size of the touch area.
why are both the numbers the same. and is this not the correct result?
if(event.getAction() == MotionEvent.ACTION_DOWN){
float x = event.getX();
float y = event.getY();
float touchMajor = event.getTouchMajor(); // major axis of ellipse touch area
float touchMinor = event.getTouchMinor(); // minor axis of ellipse touch area
// Toast.makeText(context, "x " + x , Toast.LENGTH_SHORT).show();
// Toast.makeText(context, "y " + y , Toast.LENGTH_SHORT).show();
Toast.makeText(context, "touchMajor " + touchMajor , Toast.LENGTH_SHORT).show();
Toast.makeText(context, "touchMinor " + touchMinor , Toast.LENGTH_SHORT).show();
If you return false than the touch event will be passed to the next View further up in the view hierarchy and you will receive no follow up calls.
It doesn't mean a gesture like swipe down it means that user touched the screen (finger down, the touch or gesture just started). Now you need to catch MotionEvent.ACTION_UP (finger up, gesture or touch ends here) and decide if there was a gesture you need. http://developer.android.com/training/gestures/detector.html.
To make sure that each view correctly receives the touch events intended for it, override the onInterceptTouchEvent() method.
dispatchTouchEvent(MotionEvent) - This allows your Activity to intercept all touch events before they are dispatched to the window. • ViewGroup. onInterceptTouchEvent(MotionEvent) - This allows a ViewGroup to watch events as they are dispatched to child Views.
My project group and I are interested in the same thing (we posted this: Android finger detection - Orientation and ellipse )
We have found suggestive comments that maybe the touch screen drivers for most devices do not provide this data to the system.
We have now tested: Samsung Galaxy S2, HTC One, Nexus 5 (by LG) and Nexus 7 (by Asus), Samsung Galaxy Tap3
As we tested the Samsung Galaxy Tap 3, we finally we got different values for getTouchMajor() and getTouchMinor(), but joy was only brief as we found that getTouchMajor() = getTouchMinor() * 3, in any scenario, and getOrientation() was always 0, as with all the other devices.
Our conclusion is that most devices do not support, getTouchMajor(), getTouchMinor(). or getOrientation(). This is most likely a limitation of the capacitative touch screens.
Methods such as FTIR (Frustrated Total Internal Reflection) or DI (Diffuse Illumination) based touch surfaces, which are image processing based have shown to give more rich data of the touch interaction. But as far as we know none of these methods are at all applicable on mobile technology, and no handheld device is using either of these.
We were devasted to see that the possibilities with these metrics on handheld devices cannot be pursued.
EDIT: I just recently discovered through co-students of mine, that the Samsung produced Google Nexus 10 shows an ellipse with a direction line, when you activate Input>Pointer Location under developer settings.
This indicates to me that some devices do deliver on getTouchMinor and getTouchMajor as well as orientation. (or historical versions of the same functions). I have not had the chance to code anything for the device myself but it seems plausible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With