我遇到了一个问题,如果我在片段后台堆栈中有另一个 FriendPickerFragment,我无法在 FriendPickerFragment 中显示朋友列表。
第一个 FriendPickerFragment 加载一个朋友列表,但是当我用 FriendPickerFragment 的新实例替换它时,新的不显示任何数据。
有没有人遇到过这个并知道解决方案/解决方法?
干杯!
我遇到了一个问题,如果我在片段后台堆栈中有另一个 FriendPickerFragment,我无法在 FriendPickerFragment 中显示朋友列表。
第一个 FriendPickerFragment 加载一个朋友列表,但是当我用 FriendPickerFragment 的新实例替换它时,新的不显示任何数据。
有没有人遇到过这个并知道解决方案/解决方法?
干杯!
Found the problem.
When you use the FragmentManager to add a fragment to a layout from the code the id must be unique in the whole stack of fragments.
getActivity().getSupportFragmentManager().beginTransaction()
.add(R.id.MUST_BE_UNIQUE_IN_STACK, mPickerFragment)
.commit();