I cant seem to find this answer using search engine but in the case of an activity hosting a fragment, when the activities onPostResume method is called, i am assuming that any attached fragments onResume methods will already have been called. who can confirm ?
Activity
final void performResume() {
...
mInstrumentation.callActivityOnResume(this);
...
mFragments.dispatchResume();
mFragments.execPendingActions();
onPostResume();
...
}
FragmentActivity
protected void onPostResume() {
super.onPostResume();
...
onResumeFragments();
mFragments.execPendingActions();
}
protected void onResumeFragments() {
mFragments.dispatchResume();
}
So here it depends on whether you do stuff with fragments before or after calling super.onPostResume()
in your @Override
.
turns out i had automatic build turned off in eclipse thats why when i tested it myself i was getting strange results. But for those wondering...
so fragments are resumed within the activities onResume method. But that is not guaranteed. The better approach would be to override onResumeFragment. This call back ensures the fragments are resumed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With