{"action":"created","issue":{"url":"https://api.github.com/repos/neokree/MaterialTabs/issues/17","labels_url":"https://api.github.com/repos/neokree/MaterialTabs/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/neokree/MaterialTabs/issues/17/comments","events_url":"https://api.github.com/repos/neokree/MaterialTabs/issues/17/events","html_url":"https://github.com/neokree/MaterialTabs/issues/17","id":53098827,"number":17,"title":"When using in fragment, tabs disappear on second load","user":{"login":"sebirdman","id":377555,"avatar_url":"https://avatars.githubusercontent.com/u/377555?v=3","gravatar_id":"","url":"https://api.github.com/users/sebirdman","html_url":"https://github.com/sebirdman","followers_url":"https://api.github.com/users/sebirdman/followers","following_url":"https://api.github.com/users/sebirdman/following{/other_user}","gists_url":"https://api.github.com/users/sebirdman/gists{/gist_id}","starred_url":"https://api.github.com/users/sebirdman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebirdman/subscriptions","organizations_url":"https://api.github.com/users/sebirdman/orgs","repos_url":"https://api.github.com/users/sebirdman/repos","events_url":"https://api.github.com/users/sebirdman/events{/privacy}","received_events_url":"https://api.github.com/users/sebirdman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/neokree/MaterialTabs/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2014-12-30T07:38:29Z","updated_at":"2015-04-03T13:45:58Z","closed_at":null,"body":"Hi,\r\n\r\nI've got all of this placed into a fragment. When the fragment is loaded for the first time, it works great. After i navigate away with the navigation drawer and then navigate back, the tabs no longer appear and fragments take a minute to load up again.\r\n\r\nhere is an example of my pager fragment code:\r\n\r\n\r\nEdit: Oh, it might be important to note that i'm using your navigation drawer library (it's awesome).\r\n\r\n```\r\npackage boxcrab.face.Views.Fragments;\r\n\r\nimport android.app.Activity;\r\nimport android.support.v4.app.Fragment;\r\nimport android.support.v4.app.FragmentManager;\r\nimport android.app.SearchManager;\r\nimport android.content.Context;\r\nimport android.os.Bundle;\r\nimport android.support.v4.app.FragmentStatePagerAdapter;\r\nimport android.support.v4.view.MenuItemCompat;\r\nimport android.support.v4.view.ViewPager;\r\nimport android.support.v7.app.ActionBarActivity;\r\nimport android.support.v7.widget.SearchView;\r\nimport android.util.Log;\r\nimport android.view.LayoutInflater;\r\nimport android.view.Menu;\r\nimport android.view.MenuInflater;\r\nimport android.view.MenuItem;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.widget.ImageView;\r\n\r\nimport it.neokree.materialtabs.MaterialTab;\r\nimport it.neokree.materialtabs.MaterialTabHost;\r\nimport it.neokree.materialtabs.MaterialTabListener;\r\n\r\n\r\npublic class PagerFragment extends Fragment implements MaterialTabListener {\r\n    // TODO: Rename parameter arguments, choose names that match\r\n    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER\r\n    private static final String ARG_PARAM1 = \"param1\";\r\n    private static final String ARG_PARAM2 = \"param2\";\r\n\r\n   // ImageView iv;\r\n    ViewPagerAdapter adapter;\r\n\r\n    /**\r\n     * Use this factory method to create a new instance of\r\n     * this fragment using the provided parameters.\r\n     *\r\n     * @param param1 Parameter 1.\r\n     * @param param2 Parameter 2.\r\n     * @return A new instance of fragment ImageSelect.\r\n     */\r\n    // TODO: Rename and change types and number of parameters\r\n    public static PagerFragment newInstance(String param1, String param2) {\r\n        PagerFragment fragment = new PagerFragment();\r\n        Bundle args = new Bundle();\r\n        args.putString(ARG_PARAM1, param1);\r\n        args.putString(ARG_PARAM2, param2);\r\n        fragment.setArguments(args);\r\n        return fragment;\r\n    }\r\n    public PagerFragment() {\r\n        // Required empty public constructor\r\n    }\r\n\r\n    @Override\r\n    public void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setHasOptionsMenu(true);\r\n    }\r\n\r\n    ViewPager viewPager;\r\n    MaterialTabHost tabHost;\r\n\r\n    @Override\r\n    public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n                             Bundle savedInstanceState) {\r\n\r\n        // Inflate the layout for this fragment\r\n        View rootView = inflater.inflate(R.layout.fragment_pager, container, false);\r\n        tabHost = (MaterialTabHost) rootView.findViewById(R.id.materialTabHost);\r\n        viewPager = (ViewPager) rootView.findViewById(R.id.pager_contacts);\r\n        adapter = new ViewPagerAdapter(getActivity().getSupportFragmentManager());\r\n        viewPager.setAdapter(adapter);\r\n        viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {\r\n            @Override\r\n            public void onPageSelected(int position) {\r\n                tabHost.setSelectedNavigationItem(position);\r\n            }\r\n        });\r\n\r\n        // insert all tabs from pagerAdapter data\r\n        for (int i = 0; i < adapter.getCount(); i++) {\r\n            tabHost.addTab(\r\n                    tabHost.newTab()\r\n                            .setText(adapter.getPageTitle(i))\r\n                            .setTabListener(this)\r\n            );\r\n        }\r\n\r\n        viewPager.setCurrentItem(1);\r\n\r\n        return rootView;\r\n    }\r\n\r\n    @Override\r\n    public void onTabSelected(MaterialTab tab) {\r\n        // when the tab is clicked the pager swipe content to the tab position\r\n        viewPager.setCurrentItem(tab.getPosition());\r\n\r\n    }\r\n\r\n    @Override\r\n    public void onTabReselected(MaterialTab materialTab) {\r\n\r\n    }\r\n\r\n    @Override\r\n    public void onTabUnselected(MaterialTab materialTab) {\r\n\r\n    }\r\n\r\n}\r\n\r\nclass ViewPagerAdapter extends FragmentStatePagerAdapter {\r\n\r\n    public ViewPagerAdapter(FragmentManager fm) {\r\n        super(fm);\r\n\r\n    }\r\n\r\n    public Fragment getItem(int index) {\r\n        return CustomFragment.newInstance(\"things\", \"stuff\");\r\n    }\r\n\r\n    @Override\r\n    public int getCount() {\r\n        return 6;\r\n    }\r\n\r\n    @Override\r\n    public CharSequence getPageTitle(int position) {\r\n        return \"Item \" + position;\r\n    }\r\n\r\n}\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/neokree/MaterialTabs/issues/comments/89293253","html_url":"https://github.com/neokree/MaterialTabs/issues/17#issuecomment-89293253","issue_url":"https://api.github.com/repos/neokree/MaterialTabs/issues/17","id":89293253,"user":{"login":"eirinaios","id":4653656,"avatar_url":"https://avatars.githubusercontent.com/u/4653656?v=3","gravatar_id":"","url":"https://api.github.com/users/eirinaios","html_url":"https://github.com/eirinaios","followers_url":"https://api.github.com/users/eirinaios/followers","following_url":"https://api.github.com/users/eirinaios/following{/other_user}","gists_url":"https://api.github.com/users/eirinaios/gists{/gist_id}","starred_url":"https://api.github.com/users/eirinaios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eirinaios/subscriptions","organizations_url":"https://api.github.com/users/eirinaios/orgs","repos_url":"https://api.github.com/users/eirinaios/repos","events_url":"https://api.github.com/users/eirinaios/events{/privacy}","received_events_url":"https://api.github.com/users/eirinaios/received_events","type":"User","site_admin":false},"created_at":"2015-04-03T13:45:58Z","updated_at":"2015-04-03T13:45:58Z","body":"@EdgarKogel Thank you, thank you, thank you! You can't imagine how many hours I spent debugging my code and other libraries as well, suspecting that they might be the cause of this!"}}