简体   繁体   中英

Fragment showing and Activity lifecycle

I thought that when I call

fragment.show(getSupportFragmentManager(), tag);

the activity were to PAUSED state by the calling of the onPause() method. But debugging the project I discovered that no lifecycle method is called. I was planning the flow to use the onPause() and onResume() methods when I call and dismiss a fragment, but it is confusing me. Can someone help me please?

Some observations regarding the show() method:

  • It belongs to a DialogFragment ( link );
  • It is only described by a fragment transaction (does not affect activity into enter onPause() state):

    public void show(FragmentManager manager, String tag) { mDismissed = false; mShownByMe = true; FragmentTransaction ft = manager.beginTransaction(); ft.add(this, tag); ft.commit(); }

Detailed information about an Activity lifecycle: link1 and link2

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM