S
S
sam_u2017-09-14 14:49:38
Kotlin
sam_u, 2017-09-14 14:49:38

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

2 answer(s)
N
nrgian, 2019-05-28
@nrgian

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.

Not at odds - there are plenty of other professions besides programmers.
A programming language is very easy to learn.
Therefore, it doesn't really matter.
Paradigms, concepts, principles, patterns matter.
They are the ones who learn hard.
But, at the same time, they pass from language to language.
I learned the first language - the second one will easily go, and the third one will generally fly in.
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.

Once again:
Actually the programming language itself is secondary.
You somehow give too much importance to the fact that "learn that language or learn this language."
Primarily - the actual ability to program.
This is slightly dependent on the language.
If you are familiar with the concepts, then you can start programming in the next new language in a day.
If you are going to sharpen on Android, then you will have to deal with both Java and Kotlin.
With both. And more.
But here, depending on which particular area of ​​​​Android - somewhere there is both C and C ++.
And somewhere with Android you will have to deal with C # (Unity) and Dart (Flutter), etc.
I wrote this like this - for those who really need it.
In your case, I agree with
sim3x
No
you don't need it

Because you are already doing something .
Or you don't need it.
I believe that you were simply interested in one of the aspects in computer technology.
Well, what - "quack games" is also interesting.
But what does programming have to do with it?
How exactly do you do it?
Are you just applying patches made by others?
So it's not programming at all.
Quack games, independently decompiling and analyzing the logic of their work? Congratulations, you have already figured out programming.
Core patches - if you want to get the gist - that's the C language.
Android functionality patches, game patches are Java/Kotlin/Unity first of all.
This is if you are going to create these patches yourself.
Please note that this is not about the application of patches already created by someone - something on a different level.
The "advanced housewife" can also deal with it.
There is no programming here from the word "generally".

S
sim3x, 2019-05-28
@sim3x

No
you don't need it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question