Skip to content

Is a WeakReference really necessary, and does it handle the Activity going in to the background? #17

@paulpv

Description

@paulpv

As the title asks, is a WeakReference really necessary?
The reason I ask, is that there is nothing in this API that seems to handle the case where the Activity goes in to the background.
As in, I would expect this:

    @Override
    protected void onPause()
    {
        super.onPause();
        Permiso.getInstance().setActivity(null);
    }

But setActivity is @nonnull, so this won't compile.
Will WeakReference handle the case where the Activity goes in to the background?
If not, then why not add a "Permiso.onPause" method and require the user to call it?
(Internally the code would "Activity activity = mActivity;" and test activity for null and respond appropriately)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions