1/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.example.android.supportv4.app;
17
18//BEGIN_INCLUDE(complete)
19
20import android.os.Bundle;
21import android.view.LayoutInflater;
22import android.view.View;
23import android.view.ViewGroup;
24
25import androidx.fragment.app.Fragment;
26import androidx.fragment.app.FragmentTabHost;
27
28import com.example.android.supportv4.R;
29
30public class FragmentTabsFragmentSupport extends Fragment {
31    private FragmentTabHost mTabHost;
32
33    @Override
34    public View onCreateView(LayoutInflater inflater, ViewGroup container,
35            Bundle savedInstanceState) {
36        mTabHost = new FragmentTabHost(getActivity());
37        mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.fragment1);
38
39        mTabHost.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"),
40                FragmentStackSupport.CountingFragment.class, null);
41        mTabHost.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),
42                LoaderCursorSupport.CursorLoaderListFragment.class, null);
43        mTabHost.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"),
44                LoaderCustomSupport.AppListFragment.class, null);
45        mTabHost.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"),
46                LoaderThrottleSupport.ThrottledLoaderListFragment.class, null);
47
48        return mTabHost;
49    }
50
51    @Override
52    public void onDestroyView() {
53        super.onDestroyView();
54        mTabHost = null;
55    }
56}
57//END_INCLUDE(complete)
58