Example usage for android.webkit WebView scrollTo

List of usage examples for android.webkit WebView scrollTo

Introduction

In this page you can find the example usage for android.webkit WebView scrollTo.

Prototype

public void scrollTo(int x, int y) 

Source Link

Document

Set the scrolled position of your view.

Usage

From source file:Main.java

static void paramLoader(WebView view, String url) {
    UrlQuerySanitizer sanitizer = new UrlQuerySanitizer();
    sanitizer.setAllowUnregisteredParamaters(true);
    sanitizer.parseUrl(url);/*from ww  w .  j  a  v a  2 s  . c  om*/
    String param = sanitizer.getValue("pageload");
    if (param != null) {
        switch (param) {
        case "composer":
            view.loadUrl(
                    "javascript:(function()%7Btry%7Bdocument.querySelector('button%5Bname%3D%22view_overview%22%5D').click()%7Dcatch(_)%7B%7D%7D)()");
            break;
        case "composer_photo":
            view.loadUrl(
                    "javascript:(function()%7Btry%7Bdocument.querySelector('button%5Bname%3D%22view_photo%22%5D').click()%7Dcatch(_)%7B%7D%7D)()");
            break;
        case "composer_checkin":
            view.loadUrl(
                    "javascript:(function()%7Btry%7Bdocument.querySelector('button%5Bname%3D%22view_location%22%5D').click()%7Dcatch(_)%7B%7D%7D)()");
            break;
        case "composer_top":
            view.scrollTo(0, 0);
            break;
        default:
            break;
        }
    }

}