Questions tagged [fragment-backstack]

Akin to the Android Activity backstack, the Fragment backstack is a task-like stack of Fragments (specified when adding a Fragment to a page with FragmentManager). It allows a linear navigation backwards from the current visible fragment, back through a history of previous fragments in a container until you reach the base fragment.

Akin to the Android Activity backstack, the Fragment backstack is a task-like stack of Fragments (specified when adding a Fragment to a page with FragmentManager). It allows a linear navigation backwards from the current visible fragment, back through a history of previous fragments in a container until you reach the base fragment.

Links

357 questions
1
vote
3 answers

How to replace more than one fragments with another one in the back stack?

I have the following fragments in the back stack A, B, C. Then I want to add fragment D, but in the back stack I want to put A and D instead of A, B, C, D. The problem is when I try to remove B and C with transaction.remove(), the…
X-HuMan
  • 1,488
  • 1
  • 17
  • 37
1
vote
1 answer

How to save to state of fragment on replace

I hope for your help in understanding how to implement my task. I have MainActivity in which I show one or the other fragment (for simplicity let's call them FragmentA and FragmentB). Just outside of the fragments I can influence their contents.…
1
vote
1 answer

Back Navigation in Android

I am beginner in android and trying to develop an android app in which I stuck in back navigation. My issue is : How to manage backstack with activities and fragments. A1 activity with frag1 calls A2 activity and A2 activity displays a user list…
K.K.Agarwal
  • 846
  • 5
  • 10
1
vote
1 answer

Screen freezes when popBackStack() is called

I have two fragments A & B. I have switched to B from A using following code : FragmentManager fragmentManager; FragmentTransaction transaction; fragmentManager = getActivity().getFragmentManager(); transaction =…
Pranav Karnik
  • 3,318
  • 3
  • 35
  • 47
1
vote
1 answer

Android activity with many fragments, the correct way to handle lifecycle changes?

I have an Android activity that holds and manages six fragments, is fragment is a step in a flow, some of the fragments are replaced and some of them are added. The Activity just uses a Framelayout as the container for the fragments as…
1
vote
2 answers

Remove single fragment from backstack Android

I am struggling to remove a single fragment that I add dynamically when I have multiple fragments. For examples: MainActivty Inflate FragA Inflate FragB Inflate FragC Now how do I just delete fragment A? Using popBackStack kills all three and …
SuperBale
  • 341
  • 2
  • 8
  • 20
1
vote
0 answers

Restore FragmentManager backstack

I have different layouts for portrait and landscape. My UI uses fragments stacked in back stack. On device rotation I need to set a different layout for landscape/portrait and restore the stack of fragments(note that each fragment also has different…
1
vote
1 answer

FragmentTransaction backPressed BackStack issue

I have one Activity, and four types of fragment A,B,C,D first I'll show an instance of fragA in HomeActivity - (FRAGMENT 1) from FRAGMENT1 I'll load an instance of fragB(FRAGMENT 2)(_this transaction added to backstack) from FRAGMENT 2 I'll load…
1
vote
2 answers

Android: Back stack doesnt work properly

I am making an app with a couple of screens and it has to be possible to navigate through the app with the back button. I am having trouble with one screen, my MainFragment. It doesn't seem recognise the backstack. The MainFragment is started from…
FerialTeut
  • 126
  • 9
1
vote
1 answer

fragment backstack replace issue

I have fragments in backstack which is added by using addtobackstack function. When i add a fragment without not using addtobackstack function and then press back button, the backstack is go back to wrong fragment. For example: Fragment A is…
aligur
  • 3,387
  • 3
  • 34
  • 51
1
vote
1 answer

FragmentActivity closes when back button pressed from its fragment

I have fragment activity from which I call say Fragment A then Fragment B from Fragment A and so on. I used backstack properties. So when I click back button from fragment B I goes to fragment A. But from fragment A it does not going to fragment…
Elizabeth
  • 1,399
  • 1
  • 13
  • 25
1
vote
1 answer

How to fix fragment backstack OutOfMemory issue in android?

In my android application I have list view and list item detail view. Listview and details view are fragments within one activity. Initially I load list fragment to the activity and if user clicks on list item it will replace the same view with…
1
vote
2 answers

Back Navigation does not restore the last fragment

I have a problem with back navigation since it does not restore the last fragment. All activities are AppCompatActivity using navigation_drawer(ActivityA) and scroll_activity(ActivityB) template of Android Studio ActivityA shows fragment_1…
T D Nguyen
  • 7,054
  • 4
  • 51
  • 71
1
vote
2 answers

Manage the backstack in android

Currently the structure of the android app is Home About us Products product1 product2 product3 Contact us As there is a side-menu and I can access the product 1 directly, My current attempt is add to backstack for every…
user782104
  • 13,233
  • 55
  • 172
  • 312
1
vote
3 answers

Android fragments and the backstack

I am building an android app that uses a drawer navigation and it looks and works well except i cant add the current view (fragment) to the back stack to get allow the user navigate the app more easily. at the moment the back button just exits the…
Lonergan6275
  • 1,938
  • 6
  • 32
  • 63