element.addEventListener( "touchstart", function(e){ onStart(e); }, false ); function onStart ( touchEvent ) { if( navigator.userAgent.match(/Android/i) ) { touchEvent.preventDefault(); } }This bug is documented here:
http://code.google.com/p/android/issues/detail?id=5491
and is probably not entirely unrelated to my previous post about weird Android Touch event behavior:
http://uihacker.blogspot.com/2010/10/android-bug-miss-drag-as-we-are-waiting.html
thanks a lot, used this code now, it works well.
ReplyDeletethanks very much!
ReplyDeleteIf it's useful for someone...
ReplyDeleteSamsung galaxy Tab GT-P3100 with Android 4.0.4
has a lot of problems in Phonegap...
-Slide transitions blanking...
-Touch events delays (worst than ever) with the message:
NO_FAST_DRAW=false
V/webview(24354): singleCursorHandlerTouchEvent
getEditableSupport FASLE
There is no way to prevent the delays, nor with event.preventdefault , NOTHING TO DO....
The same application, exactly the same, the same device, but wiith Android 4.0.3, WORKS PERFECTLY!!!
So, avoid upgrading Android version!
Waiting to Jelly Bean to make the application working (HOPE FOR IT)
or else.....
Thanks for this tip - I was using slide gestures to transition between pages iBooks style - where as you swipe the page follows your finger and the next one slides in a bit and depending on how far you drag it either continues slide to next page or snaps back. Couldn't figure out why it was failing so completely on Android - this totally fixed it for me.
ReplyDeleteObvious caveat is that if you still need to have the native scroll work - eg you want to use your touchmove event on horizontal swipe but you still have scrolling content vertically, you'll have to come up with a solution for that. An easy one would be to use a container div and stopping event propagation, but I'm sure there are other ways.
thanks man!!
ReplyDeletewith out preventDefault shim : https://github.com/TNT-RoX/android-swipe-shim
ReplyDeleteShim for this bug at https://github.com/TNT-RoX/android-swipe-shim
ReplyDelete