Skip to content
This repository has been archived by the owner. It is now read-only.

Commit fe3cef1

Browse files
authored
Merge pull request #296 from thefex/backstack_flag_not_respected_when_fragment_is_in_cache
AddToBackstack Flag not respected fix.
2 parents 70e1622 + ad028dc commit fe3cef1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

MvvmCross.Droid.Support.V4/MvxCachingFragmentActivity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ protected virtual void ShowFragment(string tag, int contentId, Bundle bundle, bo
258258
//Otherwise, create one and cache it
259259
fragInfo.CachedFragment = Fragment.Instantiate(this, FragmentJavaName(fragInfo.FragmentType),
260260
bundle) as IMvxFragmentView;
261-
currentFragment = fragInfo.CachedFragment as Fragment;
262261
OnFragmentCreated(fragInfo, ft);
263262
}
264263

264+
currentFragment = fragInfo.CachedFragment as Fragment;
265265
ft.Replace(fragInfo.ContentId, fragInfo.CachedFragment as Fragment, fragInfo.Tag);
266266

267267
//if replacing ViewModel then clear the cache after the fragment

MvvmCross.Droid.Support.V7.AppCompat/MvxCachingFragmentCompatActivity.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ protected virtual void ShowFragment(string tag, int contentId, Bundle bundle, bo
219219
OnFragmentCreated(fragInfo, ft);
220220
}
221221

222+
currentFragment = fragInfo.CachedFragment as Fragment;
222223
ft.Replace(fragInfo.ContentId, fragInfo.CachedFragment as Fragment, fragInfo.Tag);
223224

224225
//if replacing ViewModel then clear the cache after the fragment

0 commit comments

Comments
 (0)