问题
Is it possible that a user using android application can like that application page created in Facebook from application itself?
回答1:
Yes.
Just create a Layout with a WebView
Like
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
Create a activity
Like.class
WebView webview;
Then add the following at the end of the onCreate() method:
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl(YOUR_FB_LIKE_URL);
回答2:
I have this code fo publishing info about my app on the wall:
protected void onClickFacebook() {
Intent i = new Intent(Intent.ACTION_VIEW);
String Url = Constants.URL_FACEBOOK;
i.setData(Uri.parse(Url));
startActivity(i);
}
I think if you replace URL-facebook by your like url it should also work
来源:https://stackoverflow.com/questions/7766616/like-android-application-page-in-facebook-from-application-itself