Most visited

Recently visited

Added in API level 23

FragmentHostCallback

public abstract class FragmentHostCallback
extends FragmentContainer

java.lang.Object
   ↳ android.app.FragmentContainer
     ↳ android.app.FragmentHostCallback<E>


集成点与片段主机。

片段可以由任何对象托管; Activity 为了托管碎片,实现FragmentHostCallback ,覆盖适用于主机的方法。

Summary

Public constructors

FragmentHostCallback(Context context, Handler handler, int windowAnimations)

Public methods

void onAttachFragment(Fragment fragment)

Fragment正在连接到该主机时,在调用其 onAttach(Context)方法之后和 onCreate(Bundle)之前立即调用。

void onDump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

将内部状态打印到给定的流中。

View onFindViewById(int id)

使用给定的资源ID返回视图。

abstract E onGetHost()

返回当前托管该片段的对象。

LayoutInflater onGetLayoutInflater()

返回 LayoutInflater

int onGetWindowAnimations()

返回窗口动画。

boolean onHasView()

如果容器包含任何视图,则返回 true

boolean onHasWindowAnimations()

如果有窗口动画,则返回 true

void onInvalidateOptionsMenu()

使活动的选项菜单失效。

void onRequestPermissionsFromFragment(Fragment fragment, String[] permissions, int requestCode)

请求给定片段的权限。

boolean onShouldSaveFragmentState(Fragment fragment)

如果片段的状态需要保存,则返回 true

void onStartActivityFromFragment(Fragment fragment, Intent intent, int requestCode, Bundle options)

从给定片段开始新的 Activity

void onStartIntentSenderFromFragment(Fragment fragment, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options)

从给定片段开始新的 IntentSender

boolean onUseFragmentManagerInflaterFactory()

如果应该使用FragmentManager的 true则返回 true

Inherited methods

From class android.app.FragmentContainer
From class java.lang.Object

Public constructors

FragmentHostCallback

Added in API level 23
FragmentHostCallback (Context context, 
                Handler handler, 
                int windowAnimations)

Parameters
context Context
handler Handler
windowAnimations int

Public methods

onAttachFragment

Added in API level 23
void onAttachFragment (Fragment fragment)

Fragment被连接到该主机时,在调用其 onAttach(Context)方法之后和 onCreate(Bundle)之前立即调用。

Parameters
fragment Fragment

onDump

Added in API level 23
void onDump (String prefix, 
                FileDescriptor fd, 
                PrintWriter writer, 
                String[] args)

将内部状态打印到给定的流中。

Parameters
prefix String: Desired prefix to prepend at each line of output.
fd FileDescriptor: The raw file descriptor that the dump is being sent to.
writer PrintWriter: The PrintWriter to which you should dump your state. This will be closed for you after you return.
args String: additional arguments to the dump request.

onFindViewById

Added in API level 23
View onFindViewById (int id)

使用给定的资源ID返回视图。 如果视图不是此容器的子项,则可能返回null

Parameters
id int
Returns
View

onGetHost

Added in API level 23
E onGetHost ()

返回当前托管该片段的对象。 如果Fragment由托管Activity ,这里返回的对象应该是相同的对象从返回getActivity()

Returns
E

onGetLayoutInflater

Added in API level 23
LayoutInflater onGetLayoutInflater ()

返回LayoutInflater getLayoutInflater()

Returns
LayoutInflater

onGetWindowAnimations

Added in API level 23
int onGetWindowAnimations ()

返回窗口动画。

Returns
int

onHasView

Added in API level 23
boolean onHasView ()

如果容器持有任何视图,则返回 true

Returns
boolean

onHasWindowAnimations

Added in API level 23
boolean onHasWindowAnimations ()

如果有窗口动画,则返回 true

Returns
boolean

onInvalidateOptionsMenu

Added in API level 23
void onInvalidateOptionsMenu ()

使活动的选项菜单失效。 invalidateOptionsMenu()

onRequestPermissionsFromFragment

Added in API level 23
void onRequestPermissionsFromFragment (Fragment fragment, 
                String[] permissions, 
                int requestCode)

请求给定片段的权限。 requestPermissions(String[], int)

Parameters
fragment Fragment
permissions String
requestCode int

onShouldSaveFragmentState

Added in API level 23
boolean onShouldSaveFragmentState (Fragment fragment)

如果片段的状态需要保存,则返回 true

Parameters
fragment Fragment
Returns
boolean

onStartActivityFromFragment

Added in API level 23
void onStartActivityFromFragment (Fragment fragment, 
                Intent intent, 
                int requestCode, 
                Bundle options)

从给定片段开始新的Activity startActivityForResult(Intent, int)

Parameters
fragment Fragment
intent Intent
requestCode int
options Bundle

onStartIntentSenderFromFragment

Added in API level 24
void onStartIntentSenderFromFragment (Fragment fragment, 
                IntentSender intent, 
                int requestCode, 
                Intent fillInIntent, 
                int flagsMask, 
                int flagsValues, 
                int extraFlags, 
                Bundle options)

从给定的片段开始新的IntentSender startIntentSender(IntentSender, Intent, int, int, int, Bundle)

Parameters
fragment Fragment
intent IntentSender
requestCode int
fillInIntent Intent
flagsMask int
flagsValues int
extraFlags int
options Bundle
Throws
IntentSender.SendIntentException

onUseFragmentManagerInflaterFactory

Added in API level 23
boolean onUseFragmentManagerInflaterFactory ()

如果应该使用FragmentManager的 true则返回 true

Returns
boolean

Hooray!