Search code examples
androidandroid-webviewfacebook-comments

WebView - get back to Facebook comment when login successful


I'm developing a travel application. It has many place and user can comment on it using facebook comments.
I used a WebView to display facebook comments. It can show the comments. enter image description here

But when click login and login successfully, the webview stand at that page and don't come back to Comment box.
enter image description here

How to make WebView get back to comment box page or get something callback when login successfully?


Solution

  • Maybe you get a link back, when the page has finished loading. This link allows you to check and then trigger an action.

    WebView webView = (WebView) findViewById(R.id.webViewAuth);
    String url = "<Facebook auth url>";
    webView.loadUrl(url);
    webView.setWebViewClient(new WebViewClient() {
        public void onPageFinished(WebView view, String url) {
            view.getUrl();
        }
    });