blob: 68f06effd6a6ea1210210413cebf1e2619adfb33 [file] [log] [blame]
Dianne Hackbornbd783a02012-09-09 14:40:19 -07001/*
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)
19import com.example.android.supportv4.R;
20
21import android.os.Bundle;
22import android.support.v4.app.Fragment;
23import android.support.v4.app.FragmentTabHost;
24import android.view.LayoutInflater;
25import android.view.View;
26import android.view.ViewGroup;
27
28public class FragmentTabsFragmentSupport extends Fragment {
Dianne Hackborn7263dad2012-09-25 15:07:06 -070029 private FragmentTabHost mTabHost;
Dianne Hackbornbd783a02012-09-09 14:40:19 -070030
31 @Override
32 public View onCreateView(LayoutInflater inflater, ViewGroup container,
33 Bundle savedInstanceState) {
34 mTabHost = new FragmentTabHost(getActivity());
35 mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.fragment1);
36
37 mTabHost.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"),
38 FragmentStackSupport.CountingFragment.class, null);
39 mTabHost.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),
40 LoaderCursorSupport.CursorLoaderListFragment.class, null);
41 mTabHost.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"),
42 LoaderCustomSupport.AppListFragment.class, null);
43 mTabHost.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"),
44 LoaderThrottleSupport.ThrottledLoaderListFragment.class, null);
45
Dianne Hackbornbd783a02012-09-09 14:40:19 -070046 return mTabHost;
47 }
48
49 @Override
Dianne Hackbornbd783a02012-09-09 14:40:19 -070050 public void onDestroyView() {
51 super.onDestroyView();
Dianne Hackbornbd783a02012-09-09 14:40:19 -070052 mTabHost = null;
53 }
Dianne Hackbornbd783a02012-09-09 14:40:19 -070054}
55//END_INCLUDE(complete)