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
0
votes
3 answers

Save Fragment Data onreplace and fill in after popbackstack

I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a)…
Nickmccomb
  • 1,467
  • 3
  • 19
  • 34
0
votes
1 answer

Remove specific fragment from backstack

I have 2 fragments(Frag A, Frag B) which are shown in multi pane in landscape with different container id (R.id.containerA,R.id.containerB) respectively. My screen flow for 1st fragment is FragA->FragA1->FragA2 My screen flow for 2nd fragment is…
Siju
  • 2,585
  • 4
  • 29
  • 53
0
votes
0 answers

How to remove all object in fragment after popBackStack?

I have a problem with fragment when I make an media player app. Example I open fragmentB from fragmentA (have addToBackStack) and then back previous fragmentA from fragmentB (using popBackStack). (see more in image). When I popBackStack, all objects…
John H
  • 67
  • 1
  • 9
0
votes
1 answer

Load multiple fragment and adding it to backstack in android

I have 1 Activity and 3 fragments they're FirstFragment, SecondFragment & ThirdFragment respectively. FirstFragment loads automatically when MainActivity is open. SecondFragment loads by Button click of FirstFragment with addToBackStack flag. same…
Kasim Rangwala
  • 1,765
  • 2
  • 23
  • 44
0
votes
1 answer

Fragment backstack and toggle

I'm having an special use case where I need to switch between two fragments. The issue I'm having is that for the second fragment I need to persist it's state, and the only thing that seems to be working for that is to add it to the BackStack. I…
0
votes
1 answer

Android fragment transition on back navigation to previous fragment

I have 2 fragments the first contains a button which on clicked opens a fragment with a ListView in it. I have a shared element transition for the button to transition into the new fragment (root layout) but I would also like to have this transition…
Bootstrapper
  • 1,089
  • 3
  • 14
  • 33
0
votes
1 answer

How to use back stack properly on activities AND fragments

I have 2 activites: - LoginActivity: it will handle the login stuff later - MainActivity: the main app, all of the functions will be provided on fragments. I want to properly use the back stack, but I can't. What I want (but can't) achieve: App…
0
votes
2 answers

Fragment backstack uses too much memory

I am working on a pretty big app (about 70 fragments). When I click through my app, all my previous fragments are stored in the backstack. After some clicks my memory is pretty high and on old phones (Samsung S3) I get an OutOfMemory exception. Is…
0
votes
1 answer

Android fragments stack - back (up) button does not work

I'm completely new at Android. I was quite surprised that Android Studio does not have a template for navigation between fragments. I have spent several days now, but still cannot make my code work properly. I have single activity and two fragments…
brox
  • 87
  • 1
  • 7
0
votes
1 answer

popBackStack and addToBackStack in Android

I am very new to android and try to convert my iphone app to android. I try to nevigate between fragments, and after navigating from fragment A to B, I want to go back from fragment B to A with the back button. I made a research but could not…
saner
  • 821
  • 2
  • 10
  • 32
0
votes
1 answer

How to detect if activity stack is empty and activity stack size?

One method is to pass a bundle/store in sharedpreference through which this information is obtained. Is there a method other than such to achieve this? In fragments you can do a getBackStackEntryCount.
suku
  • 10,507
  • 16
  • 75
  • 120
0
votes
1 answer

How to onBackPressed() for android Fragments

I have 11 Fragments that are hosted in MainActivity.class, these Fragment use RecyclerView to display items. The items are clickable, When they are clicked items parse data in DetailActivity.class. The MainActivity is the parent activity. I want to…
0
votes
2 answers

Why does onBackPressed kill my app?

When I started working on this, I was using the mapbox android api instead of the google maps api. I don't think that that has much bearing on what is going wrong but, I did have the backstack working fine at some point. As it is now, I can get all…
0
votes
1 answer

Two android ViewPagers in the fragment backstack are not coming up properly after activity is recreated

My Android app has only one activity and all the fragments are added or replaced in one framelayout. The issue is when I have two different viewpagers in the fragment backstack and the activity is recreated the second viewpager comes up as the…
0
votes
0 answers

Transaction on a static Fragment layout

I am able to do a fragment transaction like this: Fragment2 frag = new Fragment2(); FragmentTransaction tr = fragmentManager.beginTransaction(); tr.add(R.id.fragment, frag); tr.addToBackStack(); tr.commit(); Simply in an activity which has this…
An-droid
  • 6,433
  • 9
  • 48
  • 93