Restoring fragment state when changing fragments through bottom navigation bar

后端 未结 4 708
星月不相逢
星月不相逢 2020-12-24 09:22

I have bottom navigation bar on click of item in navigation bar i am replacing fragments. I have 3 fragments A,B,C so on click of b item B fragment is loaded and in B i am c

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-24 09:24

    The simplest solution for that is to override "OnCreate()" method in your Fragment B and call you APIs in "OnCreate()" method instead of "OnCreateView()".

    Hope it will work for you!

提交回复
热议问题