简体   繁体   中英

Is there any launch modes for fragments like Activity launch modes?

My Problem:

* *

A ->Main Fragment where everything starts and ends, a list fragment

B ->Fragment that provides location selection from drop down and button to select location from map.

C ->Fragment that used for location selection from map

D ->Fragment that is used to Edit/Add item in the List

The Normal flows of my functionality is

  1. Main->A->B->C->D->A (Flow of adding location to the list from map)
  2. Main->A->B->D->A (Flow of adding location to the list from drop down)
  3. Main->A->D->B->D->A (Flow of Editing list)

My Doubt is the fragment B can be loaded before fragment D and after fragment D, So when i load fragment B ,

  1. i want to check whether there is already an instance and i want to reuse it
  2. other case remove the old instance and reload new.

How its done in case of fragment. In Activity we use launch modes for that.

Thanks in Advance.

FragmentManager allows you to retrieve Fragments from the back stack:

findFragmentById(int)

findFragmentByTag(String)

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