使用Facebook Sdk整合评论功能?

时间:2017-09-03 09:38:57

标签: android facebook comments integrate

我能够在应用程序中集成注释功能,但是当我单击“登录”按钮时,它无效。我正在使用WebView显示注释。为什么我在Login中的Click事件不起作用?

想要实现 enter image description here

  

点击登录不工作。评论列表显示

Rate_And_Review

   public static String BASE_DOMAIN = "http://www.facebook.com";
    public static String PATH_URL = "/patanheritage.walk.16";
    String APP_KEY = "175417393005037";
        webViewComment = (WebView) findViewById(R.id.webView_Comment);
        webViewComment.getSettings().setJavaScriptEnabled(true);
        webViewComment.getSettings().setDomStorageEnabled(true);
        webViewComment.loadDataWithBaseURL(BASE_DOMAIN,
                "<html><head></head><body><div id=\"fb-root\"></div><div id=\"fb-root\"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = \"http://connect.facebook.net/en_US/all.js#xfbml=1&appId=" + APP_KEY + "\";fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><div class=\"fb-comments\" data-href=\""
                        + BASE_DOMAIN + PATH_URL + "\" data-width=\"470\"></div> </body></html>", "text/html", null, null);
        webViewComment.setWebViewClient(new WebViewClientActivity());

class WebViewClientActivity extends WebViewClient {
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        System.out.println("onPageStarted: " + url);

    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {

        return true;
    }

    @Override
    public void onPageFinished(WebView webView, String url) {
        System.out.println("onPageFinished: " + url);

    }
}
  

为什么点击登录不起作用?如何实现这一目标。

1 个答案:

答案 0 :(得分:2)

你可能会错过这个功能尝试这样可以正常工作

@Override
   public boolean shouldOverrideUrlLoading(WebView view, String url) {
       view.loadUrl(url);
       return true;
   }