我的textview不适用于Facebook页面。
第一张图像应该是结果,但第二张图像显示而不是第一张图像。正如你在第二张图片中看到的那样,没有Like或Follow按钮
public String getFacebookPageURL() {
PackageManager packageManager = getPackageManager();
try {
int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;
boolean isFacebookEnabled = packageManager.getApplicationInfo("com.facebook.katana", 0).enabled;
if (isFacebookEnabled) {
if (versionCode >= 3002580) {
//this line is the one being returned
return "fb://facewebmodal/f?href=" + "https://facebook.com/9gag/";
} else {
return "fb://page/" + "";
}
} else {
return "https://facebook.com/9gag/";
}
} catch (PackageManager.NameNotFoundException e) {
return "https://facebook.com/9gag/";
}
}
public void tv_fbpage(View view) {
Intent intent = new Intent(Intent.ACTION_VIEW);
String facebookPageURL = getFacebookPageURL();
intent.setData(Uri.parse(facebookPageURL));
startActivity(intent);
}
答案 0 :(得分:0)
尝试fb:// page / page_id
This is a captured image from Facebook that might help
page_id是数字,可以从页面的信息菜单中找到。
ex)fb:// page / 111122223333456
public String getFacebookPageURL() {
String page_id = "111122223333456";
PackageManager packageManager = getPackageManager();
try {
boolean isFacebookEnabled = packageManager.getApplicationInfo("com.facebook.katana", 0).enabled;
if (isFacebookEnabled) {
return "fb://page/" + page_id;
} else {
return "https://facebook.com/9gag/";
}
} catch (PackageManager.NameNotFoundException e) {
return "https://facebook.com/9gag/";
}
}