Making element draggable with Android WebView (ideally, just with Javascript) ?

Posted by GJTorikian on Stack Overflow See other posts from Stack Overflow or by GJTorikian
Published on 2010-04-24T17:33:49Z Indexed on 2010/04/24 17:43 UTC
Read the original article Hit count: 321

I'm building an app with a build target of 1.5 . I have a variable, WebView browser, that is calling loadUrl to load a static HTML page from my assets folder.

In that HTML page, the following JavaScript is defined:

var  supportsTouch = ('createTouch' in document);

 ...

var w = $('wrapper');

w[supportsTouch ? 'touchmove' : 'onmousemove'] = move;
w[supportsTouch ? 'touchend' : 'onmouseup'] = function(event){ dragging = false; };

where move is another function that handles the dragging.

Unfortunately, this doesn't seem to work. I cannot figure out a concise list of which touch events are available to Android--is it ontouchmove, or touchmove? Am I supposed to set up an onTouchEvent call back in my Java code, which then launches the JavaScript function?

© Stack Overflow or respective owner

Related posts about android-sdk

Related posts about android-webview