0
他のフラグメントの親であるフラグメントがあります。私はこのようなフラグメントの子を追加しています:他のフラグメント内のタグによる子フラグメントの検索
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_main, container, false);
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.add(R.id.list_container, new SwipeableFragment(), FRAGMENT_LIST_VIEW).commit();
transaction.addToBackStack(FRAGMENT_LIST_VIEW);
return view;
}
後で、私は子供を見つける必要がある親の断片にメソッドを持っています。だから私はこのようにしています:
final Fragment fragment = getFragmentManager().findFragmentByTag(FRAGMENT_LIST_VIEW);
しかし、常にnullを返します。私は間違って何をしていますか?