pharaoh
pharaoh

Reputation: 313

Implementing fragments in Android

I am developing a application and in an activity I want it to be similar to the ICS settings application; i.e. on the left side I have a ListFragment with 4 categories, and on the right a Fragment with the content of each category, and each category has a different layout. I ran into a doubt: should I develop 4 different fragments for the categories and replace them according to the selected category, or there is a way to just use one Fragment for the content and use different layouts according to selected category?

Upvotes: 1

Views: 108

Answers (1)

David Underwood
David Underwood

Reputation: 4966

Write separate fragments and switch them out as appropriate.

Doing so makes your code more modular and allows you to take advantage of existing Android APIs (e.g. ViewPager to display your data.

Upvotes: 1

Related Questions