1. code :
FragmentFactory factory = mManager.getFragmentFactory(); fragment =
factory.instantiate(mContext.getClassLoader(), className);
2. reason :( It suggests that developers customize factory classes to instantiate Fragments, this instantiateFragment() needed to maintain
forward compatibility)
/** * Instantiates the Fragment via the FragmentManager's * {@link
androidx.fragment.app.FragmentFactory}. * * Note that this method is
<strong>not</strong> responsible for calling * {@link
Fragment#setArguments(Bundle)} on the returned Fragment instance. * * @param
context Context providing the correct {@link ClassLoader} * @param
fragmentManager FragmentManager the Fragment will be added to * @param
className The Fragment to instantiate * @param args The Fragment's arguments,
if any * @return A new fragment instance. * @deprecated Set a custom {@link
androidx.fragment.app.FragmentFactory} via * {@link
FragmentManager#setFragmentFactory(FragmentFactory)} to control * instantiation
of Fragments. */ @SuppressWarnings("DeprecatedIsStillUsed") // needed to
maintain forward compatibility @Deprecated @NonNull public Fragment
instantiateFragment(@NonNull Context context, @NonNull FragmentManager
fragmentManager, @NonNull String className, @SuppressWarnings("unused")
@Nullable Bundle args) { return
fragmentManager.getFragmentFactory().instantiate( context.getClassLoader(),
className); }
 

 

Technology
©2019-2020 Toolsou All rights reserved,
Final review of database : Summary of comprehensive application questions use Python Make simple games Laplance operator ( Second derivative ) Convert hard disk to GPT Partition format Python Implementation of Hanoi Tower code about String How to create objects vue3 Learning journey 1—— establish vue3 project java String from back to front _Java String String summary use Python Write a story about plants versus zombies 【 Greedy Algorithm 】 Huffman coding problem