Example usage for Java android.app Fragment fields, constructors, methods, implement or subclass
The text is from its open source code.
int | INITIALIZING |
int | CREATED |
int | ACTIVITY_CREATED |
int | STOPPED |
int | STARTED |
int | RESUMED |
Fragment() Default constructor. |
void | dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) Print the Fragments's state into the given stream. |
boolean | equals(Object o) Subclasses can not override equals(). |
Fragment | findFragmentByWho(String who) |
Activity | getActivity() Return the Activity this fragment is currently associated with. |
Bundle | getArguments() Return the arguments supplied to #setArguments , if any. |
FragmentManager | getChildFragmentManager() Return a private FragmentManager for placing and managing Fragments inside of this Fragment. |
Class> | getClass() Returns the runtime class of this Object . |
FragmentManager | getFragmentManager() Return the FragmentManager for interacting with fragments associated with this fragment's activity. |
int | getId() Return the identifier this fragment is known by. |
LoaderManager | getLoaderManager() Return the LoaderManager for this fragment, creating it if needed. |
Resources | getResources() Return getActivity().getResources() . |
String | getString(@StringRes int resId) Return a localized string from the application's package's default string table. |
String | getString(@StringRes int resId, Object... formatArgs) Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in java.util.Formatter and java.lang.String#format . |
String | getTag() Get the tag name of the fragment, if specified. |
CharSequence | getText(@StringRes int resId) Return a localized, styled CharSequence from the application's package's default string table. |
View | getView() Get the root view for the fragment's layout (the one returned by #onCreateView ), if provided. |
void | initState() Called by the fragment manager once this fragment has been removed, so that we don't have any left-over state if the application decides to re-use the instance. |
Fragment | instantiate(Context context, String fname) Like #instantiate(Context,String,Bundle) but with a null argument Bundle. |
Fragment | instantiate(Context context, String fname, @Nullable Bundle args) Create a new instance of a Fragment with the given class name. |
boolean | isAdded() Return true if the fragment is currently added to its activity. |
boolean | isHidden() Return true if the fragment has been hidden. |
boolean | isInBackStack() |
boolean | isRemoving() Return true if this fragment is currently being removed from its activity. |
boolean | isResumed() Return true if the fragment is in the resumed state. |
boolean | isVisible() Return true if the fragment is currently visible to the user. |
void | onActivityResult(int requestCode, int resultCode, Intent data) Receive the result from a previous call to #startActivityForResult(Intent,int) . |
void | onAttach(Context context) Called when a fragment is first attached to its context. |
void | onAttach(Activity activity) |
boolean | onContextItemSelected(MenuItem item) This hook is called whenever an item in a context menu is selected. |
Animator | onCreateAnimator(int transit, boolean enter, int nextAnim) Called when a fragment loads an animation. |
void | onCreateOptionsMenu(Menu menu, MenuInflater inflater) Initialize the contents of the Activity's standard options menu. |
void | onDestroy() Called when the fragment is no longer in use. |
void | onDestroyOptionsMenu() Called when this fragment's option menu items are no longer being included in the overall options menu. |
void | onDetach() Called when the fragment is no longer attached to its activity. |
void | onHiddenChanged(boolean hidden) Called when the hidden state (as returned by #isHidden() of the fragment has changed. |
void | onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState) Called when a fragment is being created as part of a view layout inflation, typically from setting the content view of an activity. |
void | onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) |
boolean | onOptionsItemSelected(MenuItem item) This hook is called whenever an item in your options menu is selected. |
void | onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) Callback for the result from requesting permissions. |
void | onResume() Called when the fragment is visible to the user and actively running. |
void | onViewCreated(View view, @Nullable Bundle savedInstanceState) Called immediately after #onCreateView(LayoutInflater,ViewGroup,Bundle) has returned, but before any saved state has been restored in to the view. |
void | performActivityCreated(Bundle savedInstanceState) |
void | performConfigurationChanged(Configuration newConfig) |
boolean | performContextItemSelected(MenuItem item) |
void | performCreate(Bundle savedInstanceState) |
boolean | performCreateOptionsMenu(Menu menu, MenuInflater inflater) |
View | performCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) |
void | performDestroy() |
void | performDestroyView() |
void | performLowMemory() |
boolean | performOptionsItemSelected(MenuItem item) |
void | performOptionsMenuClosed(Menu menu) |
void | performPause() |
boolean | performPrepareOptionsMenu(Menu menu) |
void | performResume() |
void | performSaveInstanceState(Bundle outState) |
void | performStart() |
void | performStop() |
void | performTrimMemory(int level) |
void | requestPermissions(@NonNull String[] permissions, int requestCode) Requests permissions to be granted to this application. |
void | restoreViewState(Bundle savedInstanceState) |
void | setArguments(Bundle args) Supply the construction arguments for this fragment. |
void | setHasOptionsMenu(boolean hasMenu) Report that this fragment would like to participate in populating the options menu by receiving a call to #onCreateOptionsMenu and related methods. |
void | setIndex(int index, Fragment parent) |
void | setInitialSavedState(SavedState state) Set the initial saved state that this Fragment should restore itself from when first being constructed, as returned by FragmentManager#saveFragmentInstanceState(Fragment) FragmentManager.saveFragmentInstanceState . |
void | setMenuVisibility(boolean menuVisible) Set a hint for whether this fragment's menu should be visible. |
void | setSharedElementEnterTransition(Transition transition) Sets the Transition that will be used for shared elements transferred into the content Scene. |
void | setSharedElementReturnTransition(Transition transition) Sets the Transition that will be used for shared elements transferred back during a pop of the back stack. |
void | setUserVisibleHint(boolean isVisibleToUser) Set a hint to the system about whether this fragment's UI is currently visible to the user. |
void | startActivity(Intent intent) Call Activity#startActivity(Intent) from the fragment's containing Activity. |
void | startActivity(Intent intent, Bundle options) Call Activity#startActivity(Intent,Bundle) from the fragment's containing Activity. |
void | startActivityForResult(Intent intent, int requestCode) Call Activity#startActivityForResult(Intent,int) from the fragment's containing Activity. |
void | startActivityForResult(Intent intent, int requestCode, Bundle options) Call Activity#startActivityForResult(Intent,int,Bundle) from the fragment's containing Activity. |
String | toString() |