KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Can anyone point me to an example or show me how to create a simple Tabbed Dialog in Android where the contents of each tab are Fragments ? All the examples/tutorials I have found are about Fragments and Tabs, but nothing specific to DialogFragments . The documentation for FragmentTabHost shows how to create tabs within normal fragments using getChildFragmentManager() . I'm assuming this should also work when the fragment is a DialogFragment but when I try it I get: java.lang.IllegalStateException: Fragment does not have a view at android.support.v4.app.Fragment$1.findViewById(Fragment.java:1425) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:901) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088) ... Here's my code for setting up the view (which is then passed to AlertDialog.setView() ): private void setupView(View v) { mTabHost = (FragmentTabHost) v.findViewById(android.R.id.tabhost); mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent); mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("Tab1"), MyDialogFragment.class, null); }
Tags (comma-separated)
Save Edits
Cancel