Answer the question
In order to leave comments, you need to log in
How to properly manage the stack of fragments in my case?
Good afternoon!
Essence of a question in short:
There is activity - in it the container for fragments.
1 frag. - ViewPager with two tabs
2 frag. - Simple layout with a couple of elements.
Fragments are switched using the menu in the navigation view.
I had 2 problems:
1. On the first run, the first fragment with the ViewPager is filled with elements, everything is OK.
Then I open the second fragment - I press back - I see the first fragment is empty, there are bookmarks, but there is no data in them.
Moreover, if I call the first fragment from my menu, it will be drawn again as it should.
What can be wrong?
2. How to competently solve the problem when the stack is filled with the same fragments. For example, I open fragment2 through the menu 5 times in a row - as a result, I need to press back 5 times to go back .. I would like 1, because this is the same screen for the user.
If you need more information, code example - write, I'll add it.
Answer the question
In order to leave comments, you need to log in
Initially, I was not at odds with programming, I studied Java, I had C ++, C #. But none of them hooked me, I didn’t really want to deal with them.
But there is an option with Kotlin. I really like to delve into android smartphones (starting with firmware, kernels, roots, etc., ending with working with .apk files for license patches, hacking premium chips in free software, etc.), and Android, judging by the last conference Google will smoothly switch to Kotlin, and this PL is now a priority.
A free summer is ahead and I would already like to find myself.
No
you don't need it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question