How to clear arguments in Fragment?

后端 未结 5 1511
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:29

    Mutating Bundle returned by getArguments() lies in gray area. You don't know and shouldn't presume how Fragment uses that Bundle instance.

    Ask yourself what happens:

    • if they decide to change getArguments() to always return different bundle instance (defensive copy)

    • or if you change arguments at wrong time

提交回复
热议问题