Is there any help, resources, example or a tutorial available for putting fragments inside a fragment?
I have two tabs put up using Action Bar Navigation tabs, which essentially are fragments. What I want to do is, put in a ListFragment and a DialogFragment (to display a view with details) in one of those Action Bar Navigation tabs fragment.
Possible?? Please help. Thanks
Here’s what I have done till now:
- Followed Android’s article on implementing navigation tabs on Action Bar and implemented a two tab action bar, this is running fine and I am able to show two different layouts.
- In one of these tabs, I want to show a Fragmented view, for this I have created a FragmentList class with custom ArrayAdapter and data items, the data detail layout and class.
- I am now stuck on how to display the fragments inside the tab. Following is the code which shows the content of first tab, how can I modify it to initialize the list fragment properly?
.
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View viewer = (View) inflater.inflate(R.layout.doodle_list, container,false);
return viewer;
}
Fragments inside of fragments is not supported.Fragments inside of fragments is supported on Android 4.2+ and via the Android Support package’s backport of fragments. I’d still look to avoid it where possible.
You chose to do that. There is nothing about action bar tabs that requires the use of fragments.