I am in a dilemma. I have a fragment which has 3 different modes. Well, it is a history fragment. The modes are:
GridView
);GridView's
cell);ImageView
and TextView
);So I can't understand how to organise this. Should I use three fragments (use nested fragments) for each mode as a child into parent fragment? Or just use one fragment with FrameLayout
and switch between different layouts? What is the best solution? Share your ideas!
I would greatly appreciate for your help. Alex. P.S. Sorry for my English:)
I would go for multiple fragments approach. It does not only help you to build reusable UI elements but also to easily supports multiple screen sizes (http://developer.android.com/guide/components/fragments.html#Design).
However, I think you only need two fragments: one fragment for the "Overview" mode and another fragment for the "Cell" mode.
You don't need a fragment for the empty mode. You should construct a view with ImageView
and TextView
and set it to the GridView
of the "Overview" fragment as an emptyView
(using GridView.setEmptyView(View)
).