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

MvxCachingFragmentCompatActivity GetLastFragmentInfo() does not return the last added fragment. #275

@markverkiel

Description

@markverkiel

I'm not sure if this is a bug or a misinterpretation, this is something that got me struggling for a while now.

Expected behavior

GetLastFragmentInfo() returning the last fragment that was added to it'sArrayList .

Actual behavior

FragmentManager.Fragments is an ArrayList and the indexes of this ArrayList change when a new fragment is added. However when a fragment is removed this ArrayList keeps it's indexes.

When a new fragment is added through the method ShowViewModel() the fragment is added where the index of the ArrayList is equal to null.

This means that the following line in GetLastFragmentInfo() does not return the last fragment add but the last fragment in the ArrayList:

var lastFragment = currentCacheableFragments.Last();

Configuration

Version: 4.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions