Pass intent to my fragment

前端 未结 2 1701
孤城傲影
孤城傲影 2021-01-15 13:35

I have implemented the NFC foreground dispatch in my Activity. The code works fine, when the NFC tag get close to my phone, the onNew

相关标签:
2条回答
  • 2021-01-15 13:53

    I figured out that Intent is an parcelable object, I can use bundle.putParcelable() method to pass the intent instance to the next fragment.

    0 讨论(0)
  • 2021-01-15 14:09

    You could store the intent in a field in your activity. Add a method like getLastIntent() and the call it in your fragment with getActivity().getLastIntent().

    Or Extrat info from the intent and create a Bundle that you will use with fragment.setArguments() and in the onStart() method of your fragment use getArguments()

    0 讨论(0)
提交回复
热议问题