I want to integrate a like button in my android app. I used the code
likeWebView = (WebView) findViewById( R.id.webView1 );
likeWebView.getSettings().setJavaScriptEnabled(true);
String url = "http://www.facebook.com/plugins/like.php?" +
"href=" + URLEncoder.encode("likeurl" ) + "&" +
"layout=standard&" +
"show_faces=false&" +
"width=500&" +
"action=like&" +
"colorscheme=light&" +
"access_token=" + URLEncoder.encode( "read_stream" );
likeWebView.loadUrl( url );
But after login it is showing a blank page.
Please give me a solution to add a Like button.
Here, in your code you must be put likeurl , url that like.
using the iframe code provided by the like button code generator at http://developers.facebook.com/docs/reference/plugins/like. But since an iframe is basically the same thing as a WebView, it seemed redundant to load the code in an iframe and then load the iframe in a WebView. So instead I just loaded the code that would be in the iframe directly into the WebView using the code below. But the same thing happens either way.
Incidentally, the same issue exists when developing an iPhone app. We don’t want the user to have to login to facebook every time they run our app. But unfortunately, if the user has logged into facebook on another computer since the last time they logged into facebook via our app, they’ll have to log in again.
On the android platform I would think a better solution might be to have a facebook app that you send an intent to that takes care of keeping the user logged in and returning the html for rendering the like button.
see more: https://github.com/facebook/facebook-android-sdk/issues/17
http://blog.doityourselfandroid.com/2011/02/28/30-minute-guide-integrating-facebook-android-application/
http://www.integratingstuff.com/2010/10/14/integrating-facebook-into-an-android-application/
integrate facebook with like button in android and iphone