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

How to manage backstack of more than one fragments properly?

I have two fragments in my activity. In the first fragment, I display the titles, when I click the titles subtitles appear. In the second fragment, I display the content of the related topic, user can navigate a different page in this fragment. When…
metis
  • 1,024
  • 2
  • 10
  • 26
0
votes
1 answer

Restoring fragment backstack for fragment with two possible backstack paths

I have one Activity with 3 fragments which form a workflow to collect user input. Normally, Fragment A is the first fragment -> Launches B -> Launches C. B is supposed to launch A if the back button is pressed, and similarly C's Back button is…
user90766
  • 329
  • 1
  • 4
  • 17
0
votes
2 answers

OnBackPress the fragment to be shown fails to update

Suppose I'm in fragment A, then moving to B, then using Back button returns to A. In the activity I'm performing the following override: @Override public void onBackPressed(){ FragmentManager fm = getSupportFragmentManager(); Fragment frag =…
0
votes
1 answer

Android: Not getting how popBackStackImmediate () behaves

I have 3 Fragments and the flow is like Fragment 1 --> Fragment 2 (adding it to back stack)--> Fragment 3 --> Fragment 1 As I want to go to Fragment 1 from Fragment 3 again, I want the back stack to be clean so that when user press back nothing…
Sunny
  • 2,074
  • 4
  • 24
  • 33
0
votes
1 answer

Pop fragment directly at starting fragment creating an issue in android

I have fragment A,B,C,D,E and navigation flow is A->B->C->D->E . So you can say that A is a base fragment from where navigation is starting. Naviagation flow Add fragment with Backstack Navigate to Fragment A A …
KDeogharkar
  • 10,939
  • 7
  • 51
  • 95
0
votes
3 answers

Android fragment simple backstack

I have one activity containing one container that will receive 2 fragments. Once the activity initialises i start the first fragment with: showFragment(new FragmentA()); private void showFragment(Fragment fragment) { …
Bugdr0id
  • 2,962
  • 6
  • 35
  • 59
0
votes
0 answers

How to Know from which fragment onBackPressed() was called

In Method: @Override public void onBackPressed() Is getting called whenever back is pressed in one of my Fragments. Is there some way I can tell which fragment is the one that is active? Or some other inforamtion inside OnBackPressed()? Added…
Yuval Levy
  • 2,397
  • 10
  • 44
  • 73
0
votes
1 answer

Fragment is showing but not attached to activity

Hi i am working in an app, in which: View pager is there on an activity. On that view pager i am showing 2 fragments(frag1 and frag2). on button click on frag1 we have added one more fragment(lets say frag3). and on back press on frag3 i come back…
Sangeeta
  • 961
  • 2
  • 13
  • 34
0
votes
1 answer

Android: add two or more fragments to the same backstack state

I have a main activity with a RelativeLayout container where i load different fragments using theFragmentManager. Let's say i load fragment1 and fragment2 with two transactions. In case of back button pressed, i want to return to the state when…
revy
  • 3,945
  • 7
  • 40
  • 85
0
votes
0 answers

How to close ActionMode when it's replace by other fragment

I've problem when using ListView in Fragment. When i using MultiChoiceModelListener, it will display ActionMode when i Long click on the item in ListView. The problem is : When ActionMode is activated, and user replace that fragment with other…
0
votes
1 answer

How to resume backstack fragment with out removing top fragments?

I want resume fragment state as follows. I have 5 fragments A,B,C,D,E. if user open fragment like A ---> B ---> C ---> D ---> E . using default back stack,back key it works fine. But when user opens A ---> B ---> C ---> D ---> E ---> B. After this…
user6318834
0
votes
1 answer

Save Last Fragment when click homebutton and back to app

Sorry for my poor English.. but i have two problems and i cant go on. I have a app (Android) and i'm working with Fragments. Problem: * I have the main activity and 3 fragments (to show other information's) In the main activity i call the fragment…
0
votes
3 answers

Return to previous fragment from other activity

I have a simple problem. My problem is that I have two activities: Activity A Activity B In Activity A I display 4-5 fragments. That is the main activity (Navigation Drawer) so I display 4-5 fragments in it. From all fragments it redirects to…
0
votes
0 answers

Fragment found in backstack after FragmentTransaction.remove()

I have 2 fragments and 1 activity. I am calling to remove the 2nd fragment from the 1st fragment via the activity like this: Fragment 1: FragmentManager manager = getActivity().getSupportFragmentManager(); if(manager.findFragmentByTag("AdFragment")…
KasparTr
  • 2,328
  • 5
  • 26
  • 55
0
votes
0 answers

Android fragment backstack behaving weird

My application currently has a single activity and a bunch of fragments. I want when the user presses the back button on their phone that they move backwards through the UI instead of exiting the application. I override onBackPressed() in my main…
java
  • 1,319
  • 6
  • 15
  • 30