Reputation: 111
Is it possible to create fragments dynamically to generate a layout containing multiple fragments something like in a grid view. Currently, i m only able to load multiple fragments provided my layout has those number of fixed fragments.
Upvotes: 6
Views: 6948
Reputation: 570
Absolutely! Check out the Android Developers guide to Fragments. Be sure the see the second bullet point here, as well as the "Performing Fragment Transactions" section: http://developer.android.com/guide/topics/fundamentals/fragments.html#Adding
Additionally you can see your options for managing Fragments in this class: http://developer.android.com/reference/android/app/FragmentTransaction.html
Upvotes: 3