我正在尝试使用以下代码打开Fragment
另一个 Fragment 内的 a,但它给了我一个空指针异常,没有任何原因。
Fragment newFragment = new SecondFragment();
// consider using Java coding conventions (upper char class names!!!)
FragmentTransaction transaction = getFragmentManager().beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack
transaction.replace(R.id.menuitem_detail_container, newFragment);
transaction.addToBackStack(null);
// Commit the transaction
transaction.commit();
这段代码在Fragment ( )内部方法的基本onItemClickListener
内部onCreateView
android.support.v4.app.Fragment
关于我可能做错了什么的任何想法?