I am browsing the source code of GestureDetector in Android 5.0.1 through this link and trying to use some of the codes in this GestureDetector program in the MainActivity.onCreate method of an Android 5.0.1 project (just for testing purpose).
In GestureDetector's source, there is a line with the following code :
private static final int DOUBLE_TAP_MIN_TIME = ViewConfiguration.getDoubleTapMinTime();
However, when I type
ViewConfiguration.getDoubleTapMinTime();
in the onCreate method, I get the error
The method getDoubleTapMinTime() is undefined for the type
ViewConfiguration
From the reference page of ViewConfiguration (this link), I find that there seems NO getDoubleTapMinTime() method.
Similar pattern holds for getDoubleTapSlop(), getScaledDoubleTapTouchSlop() methods of ViewConfiguration, ViewConfiguration seems have NO such methods, but GestureDetector in Android 5.0.1 seems have used these methods (there seems a contradiction).
I have successfully used GestureDetector (not source, just used the binary) in another Android 5.0.1 project, I suspect whether the Android 5.0.1 GestureDetector source code link is valid or not (if the link is invalid, how to find the source of GestureDetector for Android 5.0.1 ?).
Does anyone know the source for this contradiction ?
Thanks for any suggestion.
If you look at the source of ViewConfiguration closely, the method getDoubleTapMinTime()
is annotated with @hide
. It means that this method is something to be used to internally by Android and not for public consumption. The method is still present in the source code but javadoc for these methods are not generated. If you still want to use those methods, you need to use reflection. You can find more details on how to do that in this post by StarPinkER.