我想在点击另一个CustomFragment(ChatListFragment)内的按钮时显示ProfileFragment(CustomFragment),Code I' m using using给我错误;
Fragment f = null;
f=(Fragment)new Profile();
getActivity().getFragmentManager().beginTransaction().replace(R.id.content_frame, f.getFragmentManager()).commit();
错误我得到的是不兼容的类型
Required : com.android.Fragment
Found: com.myapp.ui.Profile
答案 0 :(得分:0)
试试这个:
Fragment f = new Profile();
getActivity().getFragmentManager().beginTransaction().replace(R.id.content_frame, f).commit();