Too many Activities in Android?

后端 未结 6 1973
春和景丽
春和景丽 2021-02-13 14:24

When i started my Android project i had a misunderstanding that every screen that\'s shown in the application must be a new activity. Now i am finished with the project , i have

6条回答
  •  一个人的身影
    2021-02-13 14:53

    [EDIT] - As of Google IO 2018, Google recommends using a single activity with many fragments. Something to consider.

    It ultimately depends on what you're doing. There are some times when you can not modify the view enough to make a difference. Ideally, 5-6 activities is great, but some cases thats not just not doable. I've done a mobile app with around 40 different classes, and about 18 activities. It just HAD to be done that way based on how the app was to interact with the user. If you can merge 2 or 3 activities into one, thats great. It'll help with file size and optimization as well, but if you can't- Don't fret on it too much.

提交回复
热议问题