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
1 answer

How to avoid duplicate backstack entries

I am working on an app that has a lot of fragments and while navigating through them each fragment is added to the backstack ... What I want to achieve is that I don't want duplicate backstack entries. ...e.g if I have four fragments f1,f2,f3,f4…
Raaf003
  • 103
  • 1
  • 7
0
votes
1 answer

Fragments. ActionBar Back navigation

I have one Activity and three Fragments. When I go from one fragment to another I write it transaction into backStack: transaction.addToBackStack(null); When I press back arrow on ActionBar and go to the first fragment that arrow is lose and it's…
0
votes
1 answer

Android: Fragments act unexpected (suddenly transparent?)

I have a problem with my fragments. I use this code to navigate between the fragments: Between the "main" fragments (without backstack, because I want the user to exit when he presses back (it works)): FragmentManager fragmentManager =…
Daniel
  • 753
  • 9
  • 15
0
votes
0 answers

removing fragment from backstack

I want to remove fragment from backstack in the following situations activity1-->fragment 1-->fragment activity1-->fragment 1-->activity2 in both cases on back should return to activity1 skipping fragment1. how can i achieve this.code sample would…
0
votes
1 answer

Android + Prevent addToBackStack with fragment xml?

I have 2 fragments in landscape mode, versus 1 fragment in portrait. I'm loading said fragments via the xml method. Anyway, I'm checking for the existence of the second fragment in the first activity, and either launching the second fragment's…
worked
  • 5,762
  • 5
  • 54
  • 79
0
votes
1 answer

addToBackStack not working on fragment

I searched a whole day on dozens of past stackoverflow questions but didn't find a exaustive answer about... aren't fragments handled automatically by the backstack? or have I to implement it manually? (onBackStackChanged?) or is there anything…
0
votes
2 answers

Add other fragment to backstack?

My app use 5 fragment, like this: [1]through[onClick on actionBar defined in activity]->[2]->[3]->[4]->[5] Each fragment is added to the back stack so I can go back while pressing the back button. However, I would like to return to the first…
Virthuss
  • 3,142
  • 1
  • 21
  • 39
0
votes
1 answer

android - How to back fragment 2 to fragment 1 using onbackstackchanged

The backstack is now: [fragment 1] -> [fragment 2] NearMe fragment = new NearMe(); FragmentManager frgManager2 = getFragmentManager(); frgManager2.beginTransaction().replace(R.id.content_frame,fragment).addToBackStack(null).commit(); But How to…
Parth Kathiriya
  • 137
  • 2
  • 4
  • 8
0
votes
1 answer

Fragment arguments contains NO data after retrieving from backstack

So, I have a fragment - fragment A - which contains an object - object O - used for setting up TextViews and other elements. To instantiate the fragment I use a static method A.getInstance(O). Object O is serializable so I can send it to the new…
Ionut Ciuta
  • 618
  • 1
  • 9
  • 24
0
votes
2 answers

Have only one fragment in the backstack while using Navigation Drawer

I am using a navigation drawer.So when my application starts i am calling the homeFragment and keeping it in the backstack. Now if the user selects any options from the navigation drawer i am opening the respective fragment but without adding them…
Archana Vetkar
  • 63
  • 2
  • 11
0
votes
2 answers

maintaining a Back stack for fragments as well as confirm on exit

I am actually working on fragments instead of activities .So on navigation drawer item click different fragments appear on the screen.Based on my code, if i am moving from Activity A to fragment b,then fragment c,again to b,then if i will…
0
votes
1 answer

All fragments on backstack, have nulls in onSaveInstanceState, after rotation

After rotating a device, any fragment we have on the backstack or in the fragmentSupportManager, activates the onSaveInstanceState. However, after the first rotation, everything inside is null (all variables) and the app crashes with null pointer…
Russ Wheeler
  • 2,590
  • 5
  • 30
  • 57
0
votes
3 answers

Handling fragment backstack in Navigation drawer

okay i know there are other questions that on first glance make this one look like a duplicate, but none of these answers work in my case, What i want is the first fragment displayed to be like a Main Activity in respect to how the back button…
Martin Seal
  • 616
  • 2
  • 14
  • 32
0
votes
1 answer

how to save listview items/adapter in fragment and restore from back stack

I've been tried to search about this problem but I couldn't get any solution. I've got a problem about saving ListView items in fragment. The case is I have several fragments let say FRAGMENT A, FRAGMENT B and FRAGMENT C, and FRAGMENT A has a …
0
votes
1 answer

How should I add my initial fragment while supporting screen rotations?

When my app starts I dinamically add a fragment instance (say, fragment1) to the content layout in a transaction which is not added to the back stack. This fragment displays some cached data which has been passed to it by means of a…
Piovezan
  • 3,215
  • 1
  • 28
  • 45