How to clear arguments in Fragment?

后端 未结 5 1517
Happy的楠姐
Happy的楠姐 2021-02-20 01:58

I have an AudioPlayerFragment to which I pass some url with setArguments().

If I have an url key in the getArguments() of my insta

5条回答
  •  后悔当初
    2021-02-20 02:14

    Do not try to change the argument. Instantiate the Fragment again with no argument and replace it with the old one.

    If you do not want to recreate the UI and only try to change the music or audio, you can decouple the audio functions from your fragment and put them in a Headless Retained Fragment and you are good to go.

提交回复
热议问题