How to add call a callback in the Activity when there is a Fragment pushed
from back stack
please give me advice how to handle following situation.. I have a main
Activity with navigation drawer..When the user clicks on items in the
drawer, I change currently attached fragment with another one -
accordingly to the pressed drawer item. I also want to handle the
situation when the user clicks on the item related to at the same time
already attached fragmen and avoid fragment recreate..
So I came up with following solution. I have an property in which I hold
the TAG of my current fragment. When the user clicks on any item form the
drawer I check the if TAGs are matching and of not I do a switch..I works.
But I have an problem with back stack navigation. I dont know how to
change the TAG holding property when the user clicks on the back button.
The fragment changes properly, but the TAG property stays the same, so
that it all becames broken (when the user clicks on the item he was
before, he is not redirected and furthemore after click on the item
related to the fragment pushed from back stack it does the recreate:/)
Hope you guys got where is my problem..I dont give here any code. I just
think its not necessary, because my problem is not actually in an existing
part of my code, but in a hypothetical yet nonexisting one:) I just need
to handle the pushed-from-backstack situation..
Thanks in advance!
No comments:
Post a Comment