Thomas
Thomas

Reputation: 8930

Android best practice : 2 activities or 1 activity with multiple layouts?

I have two main screens in my app : main view and settings. Should there be two activities for that ? Or should 1 main activity, 2 layouts and I hide/show them when necessary ?

Upvotes: 1

Views: 227

Answers (4)

Spotlight
Spotlight

Reputation: 1299

I suggest to use two different activities that extends an abstacts Activity created by you, in which you'll add all the custom features you need on both activities.

Upvotes: 0

Giancarlo
Giancarlo

Reputation: 745

You can use Fragments (1 for Main, 1 for settings). For more information go to http://developer.android.com/guide/components/fragments.html

Upvotes: 0

erik
erik

Reputation: 4948

I would also say two activities.. It really depends on your goals both user experience wise and functionally. Of course paying close attention to how they interact with each other (startActivity vs startActivityForResult) and savedInstanceState s

http://developer.android.com/reference/android/app/Activity.html

Upvotes: 0

Stephane Mathis
Stephane Mathis

Reputation: 6612

Two activities. Acceptable option is one activity with multiple fragments.

Upvotes: 2

Related Questions