0

We are using the MvvmCross Framework (Version 4.4) in one of our Apps (Android with native UI). Sometimes (it is not reproducable) the app does crash, because after navigating the wrong fragment/activity is still alive.

For example: We are navigating to MyNewTargetView, but within the OnViewCreated method “this” is still “MenuView”. One of our fragments must implement listener for a listview, and those listener are of course not implemented within the MenuView.

Has anyone ever experienced this kind of problem and can hint us, what to do to solve this problem?

1 Answers1

0

May be this can be due to you are using "new" for creation of fragment. Like instead of creating fragments using new keyboard use newInstance method. This will solve many of your problems like when activity/fragment recreated you param values which you were passing in constructor of method will be save (which cause crash sometimes due to memory issues). Best practice for instantiating a new Android Fragment

Community
  • 1
  • 1
Qandil Tariq
  • 539
  • 1
  • 3
  • 15
  • Thank you for your recommendations, we will keep them in mind. For this project, we searched through our code, but didn’t find any place, where we are creating the fragments. It seems, that this is completely handled by MvvmCross… – Mephistopheles May 18 '17 at 07:58