我对 android 和 facebook 插件很陌生。尝试按照 facebook
开发人员网站中提到的以下步骤进行操作。
https://developers.facebook.com/docs/android/scrumptious/authenticate/
转到第 3 步。
I followed it without missing any steps.
However, I do not see a menu at the bottom when i am logged in.Any help?
Below is the snippet of important codes and xml.
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// only add the menu when the selection fragment is showing
if (fragments[SELECTION].isVisible()) {
if (menu.size() == 0) {
Log.d("onPrepareOptionsMenu","Yes");
settings = menu.add(R.string.settings);
}
return true;
} else {
menu.clear();
settings = null;
}
return false;
}
在main.xml之后
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment android:name="com.punit.xxx.SelectionFragment"
android:id="@+id/selectionFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment android:name="com.punit.xxx.SplashFragment"
android:id="@+id/splashFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment android:name="com.facebook.widget.UserSettingsFragment"
android:id="@+id/userSettingsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
我试图放一些日志,发现 OnPrepareotionsMenu 从未被调用过。