Pass intent to my fragment

前端 未结 2 1703
孤城傲影
孤城傲影 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 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()

提交回复
热议问题