Dilemma: when to use Fragments vs Activities:

后端 未结 14 826
失恋的感觉
失恋的感觉 2020-11-22 11:58

I know that Activities are designed to represent a single screen of my application, while Fragments are designed to be reusable UI layouts with log

14条回答
  •  Happy的楠姐
    2020-11-22 12:20

    You are free to use one of those.
    Basically, you have to evaluate which is the best one to your app. Think about how you will manage the business flow and how to store/manage data preferences.

    Think about, how Fragments store garbage data. When you implement the fragment, you have a activity root to fill with fragment(s). So, if your trying to implement a lot of activities with too much fragments, you have to consider performance on your app, coz you're manipulating (coarsely speaks) two context lifecycle, remember the complexity.

    Remember: should I use fragments? Why shouldn't I?

    regards.

提交回复
热议问题