2

I just need a little guidance on how do I structure my android app

I have an android app that has five to seven screens. Now the way I have structured the app is that I have one single activity that loads on app start which is more like a gateway to start exploring the screens. This activity also has container which I use to show the fragments. Every fragment represents a screen.

So is this structure of one single activity and multiple fragments a valid and a good one or may be the app can be structured in a better way?

  • This is a contentious issue. Your question may be closed as it is opinion-based, or because it is a duplicate. Personally, at work I have a single activity app and at home a multi-activity app. I find the overhead of managing fragments is too much and prefer multi-activity. – Synesso Jan 15 '15 at 06:15
  • Does it really have any performance issue or any other issues if I continue with my app structure? –  Jan 15 '15 at 06:25

1 Answers1

1

There might be various ways to organise an application,

You can organise it by component/class types

activity/
    // all activities here
fragment/
    // all fragments here
service/
receivers/
utils/

Or you can organise it by features you provide in your app(say by UI)

feature1/
    ActivityOne.java
    FragmentOne.java
    FragmentTwo.java
    FragmentThree.java

feature2/
    ActivityOne.java
    FragmentOne.java
    FragmentTwo.java
    FragmentThree.java
Rachit Mishra
  • 6,101
  • 4
  • 30
  • 51