Say I have an Activity
that has a Fragment
embedded via it's XML layout like:
<fragment
android:id="@+id/detaillist"
android:name="com.example.DetailListFragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
tools:layout="@android:layout/list_content" />
In the Fragment
I depend on something that happens in the Activity
's onCreate
method. At what Fragment
lifecycle callback can I be sure that the Activity
's onCreate
is done?
@Override
public void onActivityCreated(Bundle savedInstanceState) {
}
This function of the Fragment
will help you to know onCreate
of Activity is done. Hope this will help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.