Android Webview App: srolling & mailto links

September 14, 2012 at 09:58
Android Apps

I wrote myself a little android app, which is nothing more than a webview - calling a web page not from the android browser but within the app. During the process I encountered a few problems with my Samsung Galaxy SIII: 1. the scrolling plugins (jquery autoscoll, touchcarousel) didn't work Only by accident I stumbled across iscroll-4, where I learned how to cope with this problem:
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
And after that, everything worked like a charm! 2. mailto links were not handled correctly This problem needs to be taken care of by changing something within your app program. in WebViewClient extended I modified shouldOverrideUrlLoading a little:
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
                MailTo mt = MailTo.parse(url);
                Intent i = newEmailIntent(CreareActivity.this, mt.getTo(), mt.getSubject(), mt.getBody(), mt.getCc());
                return true;
            return true;
Thanks a lot for this entry at stackoverflow !

Hinterlasse einen Kommentar: