Java android.app Fragment fields, constructors, methods, implement or subclass

Example usage for Java android.app Fragment fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.app Fragment.

The text is from its open source code.

Subclass

android.app.Fragment has subclasses.
Click this link to see all its subclasses.

Field

Constructor

Fragment()
Default constructor.

Method

voiddump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)
Print the Fragments's state into the given stream.
booleanequals(Object o)
Subclasses can not override equals().
FragmentfindFragmentByWho(String who)
ActivitygetActivity()
Return the Activity this fragment is currently associated with.
BundlegetArguments()
Return the arguments supplied to #setArguments , if any.
FragmentManagergetChildFragmentManager()
Return a private FragmentManager for placing and managing Fragments inside of this Fragment.
ClassgetClass()
Returns the runtime class of this Object .
FragmentManagergetFragmentManager()
Return the FragmentManager for interacting with fragments associated with this fragment's activity.
intgetId()
Return the identifier this fragment is known by.
LoaderManagergetLoaderManager()
Return the LoaderManager for this fragment, creating it if needed.
ResourcesgetResources()
Return getActivity().getResources().
StringgetString(@StringRes int resId)
Return a localized string from the application's package's default string table.
StringgetString(@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 .
StringgetTag()
Get the tag name of the fragment, if specified.
CharSequencegetText(@StringRes int resId)
Return a localized, styled CharSequence from the application's package's default string table.
ViewgetView()
Get the root view for the fragment's layout (the one returned by #onCreateView ), if provided.
voidinitState()
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.
Fragmentinstantiate(Context context, String fname)
Like #instantiate(Context,String,Bundle) but with a null argument Bundle.
Fragmentinstantiate(Context context, String fname, @Nullable Bundle args)
Create a new instance of a Fragment with the given class name.
booleanisAdded()
Return true if the fragment is currently added to its activity.
booleanisHidden()
Return true if the fragment has been hidden.
booleanisInBackStack()
booleanisRemoving()
Return true if this fragment is currently being removed from its activity.
booleanisResumed()
Return true if the fragment is in the resumed state.
booleanisVisible()
Return true if the fragment is currently visible to the user.
voidonActivityResult(int requestCode, int resultCode, Intent data)
Receive the result from a previous call to #startActivityForResult(Intent,int) .
voidonAttach(Context context)
Called when a fragment is first attached to its context.
voidonAttach(Activity activity)
booleanonContextItemSelected(MenuItem item)
This hook is called whenever an item in a context menu is selected.
AnimatoronCreateAnimator(int transit, boolean enter, int nextAnim)
Called when a fragment loads an animation.
voidonCreateOptionsMenu(Menu menu, MenuInflater inflater)
Initialize the contents of the Activity's standard options menu.
voidonDestroy()
Called when the fragment is no longer in use.
voidonDestroyOptionsMenu()
Called when this fragment's option menu items are no longer being included in the overall options menu.
voidonDetach()
Called when the fragment is no longer attached to its activity.
voidonHiddenChanged(boolean hidden)
Called when the hidden state (as returned by #isHidden() of the fragment has changed.
voidonInflate(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.
voidonInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState)
booleanonOptionsItemSelected(MenuItem item)
This hook is called whenever an item in your options menu is selected.
voidonRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults)
Callback for the result from requesting permissions.
voidonResume()
Called when the fragment is visible to the user and actively running.
voidonViewCreated(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.
voidperformActivityCreated(Bundle savedInstanceState)
voidperformConfigurationChanged(Configuration newConfig)
booleanperformContextItemSelected(MenuItem item)
voidperformCreate(Bundle savedInstanceState)
booleanperformCreateOptionsMenu(Menu menu, MenuInflater inflater)
ViewperformCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
voidperformDestroy()
voidperformDestroyView()
voidperformLowMemory()
booleanperformOptionsItemSelected(MenuItem item)
voidperformOptionsMenuClosed(Menu menu)
voidperformPause()
booleanperformPrepareOptionsMenu(Menu menu)
voidperformResume()
voidperformSaveInstanceState(Bundle outState)
voidperformStart()
voidperformStop()
voidperformTrimMemory(int level)
voidrequestPermissions(@NonNull String[] permissions, int requestCode)
Requests permissions to be granted to this application.
voidrestoreViewState(Bundle savedInstanceState)
voidsetArguments(Bundle args)
Supply the construction arguments for this fragment.
voidsetHasOptionsMenu(boolean hasMenu)
Report that this fragment would like to participate in populating the options menu by receiving a call to #onCreateOptionsMenu and related methods.
voidsetIndex(int index, Fragment parent)
voidsetInitialSavedState(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 .
voidsetMenuVisibility(boolean menuVisible)
Set a hint for whether this fragment's menu should be visible.
voidsetSharedElementEnterTransition(Transition transition)
Sets the Transition that will be used for shared elements transferred into the content Scene.
voidsetSharedElementReturnTransition(Transition transition)
Sets the Transition that will be used for shared elements transferred back during a pop of the back stack.
voidsetUserVisibleHint(boolean isVisibleToUser)
Set a hint to the system about whether this fragment's UI is currently visible to the user.
voidstartActivity(Intent intent)
Call Activity#startActivity(Intent) from the fragment's containing Activity.
voidstartActivity(Intent intent, Bundle options)
Call Activity#startActivity(Intent,Bundle) from the fragment's containing Activity.
voidstartActivityForResult(Intent intent, int requestCode)
Call Activity#startActivityForResult(Intent,int) from the fragment's containing Activity.
voidstartActivityForResult(Intent intent, int requestCode, Bundle options)
Call Activity#startActivityForResult(Intent,int,Bundle) from the fragment's containing Activity.
StringtoString()