If I declare a fragment in an XML layout, how do I pass it a Bundle?

前端 未结 6 786
南笙
南笙 2020-12-01 12:01

I\'ve got an activity that I\'ve replaced with a fragment. The activity took an Intent that had some extra information on what data the activity was supposed to display.

6条回答
  •  暖寄归人
    2020-12-01 12:06

    It's not an encapsulated way, but I ended up "pulling" the bundle from the parent activity:

    Bundle bundle = getActivity().getIntent().getExtras();
    

提交回复
热议问题