How can I pop fragment from backstack without resuming it? I just want to remove from back stack, I don’t want to display it.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s architectural question.
1)Suppose we have 2 controllers (fragments/activities): controller A and controller B.
Both of them connected to one instance of some Model (you may use binding with service, Singleton pattern or init model in Application-heir class and make a getter to it).
When something interesting happens in controller B, he notifies model about it and then model calls controllerA.finish() / controllerA.remove().
Of course, I always try to implement this solution as nicely as possible, but there is a main idea.
2)In another circumstances, I call finish() immediately after startActivity(intent);
3)Also I may write: startActivityForResult(intent, requestCode) and after finishing second activity method onActivityResult(requestCode, responseCode, intent) is called – if requestCode’s are equal, I finish the activity.