I have a problem in my app . first fragment has many post(Textview in RecyclerView) and when user click one of item go to second fragment; and second fragment is like first fragment and when click one of item in second fragment go to third fragment . User can click item and go other fragment and i dont know how many fragment need in app . I want when user click back from third fragment ,go to the second fragment and like this second fragment to first fragment. I use List of fragment and add fragment to list but after 30 second garbage collector removed this list and when user click back ,catch null exception error for previous fragment; how can do this issue guys? if you can't understand , say to explain more;
Asked
Active
Viewed 52 times
0
-
show it with code. – Ehsan Pagheh Feb 19 '22 at 09:00
-
for example my app has List
list when click item list.add(firstFragment) and show first fragment whit item...and again click item and list.add(secondFragment) and show second fragment with item... when click back app shuould do list.remove(secondfragment) and show firstfragment with item...i hope understand it – Sobhan Feb 19 '22 at 09:16 -
Does this answer your question? [Programmatically go back to the previous fragment in the backstack](https://stackoverflow.com/questions/10863572/programmatically-go-back-to-the-previous-fragment-in-the-backstack) – Alias Cartellano Feb 19 '22 at 18:23