Skip to content

Incorrect behavior with FragmentPagerAdapter and Dagger #246

@bitvale

Description

@bitvale

Hi! I have an Activity with view pager. In view pager I show one fragment (one - because it's an example) with FragmentPagerAdapter. In this one fragment I inject presenter using Dagger. In phone developer settings I enable Not save activity state option. Now when I press home button activity and fragment are destroyed, but presenter not and when I came back to the app two instance of presenter is created: one - the old and one - new is injected. But if I add mvpDelegate.onDestroy() in fragments onDestroy the presenter is destroyed, new instance is injected and there is no old presenter instance.

There is a lot of code to paste. I've created a sample project to show this issue. Run it and see log after destroy and resume. But before go to settings and enable Not save activity state option.

Link to project: https://github.com/bitvale/MoxyIssue

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