Fragment与FragmentAcitvity间的传值


FragmentActivity中传值

Bundle bundle=new Bundle();

        bundle.putSerializable(“companyInfor”, company);

 companyExhFragment.setArguments(bundle);


Fragment中接收值

Bundle bundle=getArguments();
if(bundle!=null)//接收从activity中传来的值
   company=(RecommendCompanyResult) bundle.getSerializable(”companyInfor“);


注意:一定要新建一个Bundle对象,不能引用其他页面传来的Bundle 
 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2022-03-03
  • 2021-08-15
猜你喜欢
  • 2021-05-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2021-08-02
  • 2021-11-21
  • 2022-12-23
相关资源
相似解决方案