like android application page in facebook from application itself

和自甴很熟 提交于 2019-12-09 23:47:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!