Skip to content

Backstack is not available in a child Fragment's onCreate after process death #275

Open
@Zhuinden

Description

@Zhuinden

Currently, the general usage is to use onViewCreated, however the only reason why it's unavailable in onCreate is that internally, the Backstack is maintained by a platform retained fragment.

Although on second thought, as Fragment.onCreate is executed by Activity's super.onCreate after process death, it wouldn't have a state changer, so calling lookupService on it then would have also failed anyway.

Still, this means that Fragment.onCreate is kind of a liability. Not sure what can be done about this other than saying "use onViewCreated instead" or do a handler.post. Most likely just documentation issue, as this is fragment design (I don't think we need to recreate services until the state changer is set).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions