Best practice for instantiating a new Android Fragment

前端 未结 13 1472
暖寄归人
暖寄归人 2020-11-21 04:38

I have seen two general practices to instantiate a new Fragment in an application:

Fragment newFragment = new MyFragment();

and

<         


        
相关标签:
13条回答
  • 2020-11-21 05:23

    There is also another way:

    Fragment.instantiate(context, MyFragment.class.getName(), myBundle)
    
    0 讨论(0)
提交回复
热议问题