How to prevent calling onCreateView when back button pressed in fragment in android

后端 未结 3 1999
执念已碎
执念已碎 2021-02-12 13:21

In my application, I have tabbar functionality. In one tab i am displaying server data in lisview, and on clicking on that detail page for that list item will be open in new fra

3条回答
  •  春和景丽
    2021-02-12 13:51

    I don't think prevent calling onCreateView is a good idea, beside if the function is not called, there will be exception, so NO, you shouldn't. Instead of doing that, I suggest you move your "listview created and new fetches new server data" into another place where you can call explicitly (when you want, where you want, onCreate() is a good place), don't put it in onCreateView(). Hope this helps.

提交回复
热议问题