Android supports an event onLongPress. The question I have is 'how long' (in milliseconds) is the 'press' to trigger the event?
You can use the getLongPressTimeout
method in android.view.ViewConfiguration
to programmatically determine this value.
See the docs for details.
Hmmm ... I was hoping to get the accumulative time. As far as I can tell, getLongPressTimeout(), is the component time that is added to when event-press is determined to be start, plus TAP_TIMEOUT, plus ??? and then 1000ms if in the web browser.
I have calculated it to be 1650ms but I would like to have some confirmation of the resultant value. The reason is that I need something that is not integrated with the SDK to predict the long-hold.
I believe the value from getLongPressTimeout is 500ms, but the gesture clearly takes longer -- closer to 2 seconds.
View (and therefore most of its subclasses) uses getLongPressTimeout. Perhaps the default timeout was not sufficient in the browser.
The standard long press time is what is returned by getLongPressTimeout(), which is currently 500ms but may change (in 1.0 it was 1000ms but changed in a later release; maybe in the future it will be user-customizable).
The browser uses its own long press time because it has some more complicated interactions. I believe this should be 1000, though again it may change in the future. It is not adding the different timeouts together.