我有个问题。此代码在我的 nexus 10 android 4.2.1 上运行良好。但是在 AVD android 2.3 上它给了我
NullPointerException com.example.training.ContentFragment.onCreateOptionsMenu(ContentFragment.java:97)
所以我有两个导航选项卡,每个选项卡有两个片段。
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// Inflate the menu; this adds items to the action bar if it is present.
activity.getSupportMenuInflater().inflate(R.menu.trainings_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
}
有人可以帮我弄这个吗?