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
2
votes
2 answers

Android peek backstack without popping

For my application, some fragments require the user to enter a pin in a dialog before it is shown. I have a BaseFragment class that all my other fragments extend which stores if the pin is required. My issue right now is dealing with the back button…
Joe Jankowiak
  • 1,059
  • 12
  • 37
2
votes
0 answers

Instagram type backstack navigation Android

How to implement navigation like instagram where every tab of theirs has it's own back stack? I have a TabLayout with 5 tabs and I inflate many different fragments in each tab individually depending on user action but it all just gets added to the…
2
votes
0 answers

Fragment is not in backstack but fragment is still visible with replace method

I had created a utility file to replace and add the fragment to backstack, if the fragment is not in backstack otherwise just replace the fragment and the current fragment must not be the same or at the top of stack, This fragment method works…
2
votes
1 answer

Fragment not attached to Activity when back pressed

I have an implementation of fragment as explained here. I have expanded the BaseFragment class to handle navigation icon onClickListener. The code for that looks like this, private void onBackButtonPressed(int tag) { switch (tag) …
Zach
  • 9,989
  • 19
  • 70
  • 107
2
votes
3 answers

Implementing back stacks with fragments

I'm attempting to implement a back stack while using fragments, but when using the Back button, I keep getting taken out of the app to the home screen. Activity opens fragment A; Fragment A has a clickable TextView that opens fragment B (this…
mwieczorek
  • 2,107
  • 6
  • 31
  • 37
2
votes
3 answers

can the order of the fragments in the backstack be changed programmatically

Having A->B->c in back stack, A is at top. At the time it would like to have C to be on top, and keep A, B in the order in the stack. In the requirement it cannot have two C instances in the stack. The problem is if pop the C then all A, B is…
lannyf
  • 9,865
  • 12
  • 70
  • 152
2
votes
2 answers

App crash by "back" to maps fragment

I working on my first app and got problems with the "back" function. When i open the app an click in the menu to another fragment (2,3 or 4) and i push the back button the app crashes. When i start the app and click 2 > 3 > 4 (in this order) in the…
CodeNinja
  • 836
  • 1
  • 15
  • 38
2
votes
2 answers

How to clear fragment backstack till a specified fragment?

I am working on an application that has tabs with viewpager. I am using fragmentstatepageradapter for handling the viewpager tabs. I am replacing the first fragment with nested fragments using the childFragmentmanager and adding the current fragment…
2
votes
3 answers

How to avoid Fragment going back to previous Fragment on pressing device back button?

I am developing an android in which when I pressed device back button I go to previous fragment. What I want to achieve is that when I pressed device back button I don't want to go to previous fragment. How can I achieve that?.
Niraj Kumar
  • 49
  • 1
  • 8
2
votes
0 answers

how to handle back stack in fragment with config changes?

Activity | | Fragment1 --> Fragment2 --> Fragment3 --> Fragment4 | | Orientation changed …
2
votes
0 answers

Fragment navigate back without adding to back stack

This was asked in one of the interviews. The scenario is described as follows : MainActivity (initially has Fragment A added to it.). On pressing a button, it goes to Fragment B, without adding A to backstack. On pressing a button in Fragment B, it…
gaurav jain
  • 3,119
  • 3
  • 31
  • 48
2
votes
2 answers

Android backstack is null in onCreate method

I have two fragments in main Activity (1st fragment, 2nd fragment). I replace the 1st fragment with the container view in the onCreate method of main activity. In the 2nd fragment there is a ListView and when clicking an item on it, a new Activity…
Mehmet
  • 1,467
  • 1
  • 14
  • 19
2
votes
2 answers

Android - Blank fragment when returning from backstack

I have a view that shows a List of Properties, at the bottom of the screen there's a button that opens a fragment containing a MapView. @Override public void onClick(View v) { switch (v.getId()) { case R.id.find_property_btn_map: …
2
votes
1 answer

Handle onResume() not called when recreating fragment from backstack

I recently started refactoring my Android application by replacing "all" activities with fragments. In the state it is right now, it behaves a lot worse than before... My problems are in the area of "up navigation", backstack behaviour and general…
2
votes
1 answer

android show next fragment before popping backstack

I have several fragments that keep replacing each other (with the transactions added to the backstack). Depending on user actions at some point I need to clear all (or some) of the previous fragments and show only 1 new fragment. To do this I…
source.rar
  • 8,002
  • 10
  • 50
  • 82