Fragment.java revision f121be737c59390d97e21a92be8e166001534c7d
1/* 2 * Copyright (C) 2010 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 */ 16 17package android.app; 18 19import android.content.ComponentCallbacks; 20import android.content.Context; 21import android.content.res.Configuration; 22import android.os.Bundle; 23import android.util.AttributeSet; 24import android.view.LayoutInflater; 25import android.view.View; 26import android.view.ViewGroup; 27import android.view.animation.Animation; 28 29/** 30 * A Fragment is a piece of an application's user interface or behavior 31 * that can be placed in an {@link Activity}. 32 */ 33public class Fragment implements ComponentCallbacks { 34 static final int INITIALIZING = 0; // Not yet created. 35 static final int CREATED = 1; // Created. 36 static final int STARTED = 2; // Created and started, not resumed. 37 static final int RESUMED = 3; // Created started and resumed. 38 39 int mState = INITIALIZING; 40 int mBackStackNesting; 41 Activity mActivity; 42 43 boolean mCalled; 44 int mContainerId; 45 46 ViewGroup mContainer; 47 View mView; 48 49 public Fragment() { 50 } 51 52 public Activity getActivity() { 53 return mActivity; 54 } 55 56 public void onInflate(Activity activity, AttributeSet attrs) { 57 mCalled = true; 58 } 59 60 public void onAttach(Activity activity) { 61 mCalled = true; 62 } 63 64 public Animation onCreateAnimation(int transit, boolean enter) { 65 return null; 66 } 67 68 public void onCreate(Bundle savedInstanceState) { 69 mCalled = true; 70 } 71 72 public View onCreateView(LayoutInflater inflater, ViewGroup container) { 73 return null; 74 } 75 76 public void onRestoreInstanceState(Bundle savedInstanceState) { 77 } 78 79 public void onStart() { 80 mCalled = true; 81 } 82 83 public void onResume() { 84 mCalled = true; 85 } 86 87 public void onSaveInstanceState(Bundle outState) { 88 } 89 90 public void onConfigurationChanged(Configuration newConfig) { 91 mCalled = true; 92 } 93 94 public Object onRetainNonConfigurationInstance() { 95 return null; 96 } 97 98 public void onPause() { 99 mCalled = true; 100 } 101 102 public void onStop() { 103 mCalled = true; 104 } 105 106 public void onLowMemory() { 107 mCalled = true; 108 } 109 110 public void onDestroy() { 111 mCalled = true; 112 } 113 114 public void onDetach() { 115 mCalled = true; 116 } 117} 118