Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

LockManager.getInstance() on a null object reference #180

Open
cgao97 opened this issue Jun 21, 2018 · 1 comment
Open

LockManager.getInstance() on a null object reference #180

cgao97 opened this issue Jun 21, 2018 · 1 comment

Comments

@cgao97
Copy link

cgao97 commented Jun 21, 2018

Hi guys, I got this message when I tried to add an ignored activity. Below is the code and error message.

LockManager lockManager = LockManager.getInstance();
lockManager.getAppLock().addIgnoredActivity(this.getClass());

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.github.omadahealth.lollipin.lib.managers.AppLock.addIgnoredActivity(java.lang.Class)' on a null object reference

Please help, thank you.

@alexkeramidas
Copy link
Contributor

I think you should do ActivityName.class in there and not this.getClass().

Ideally, the addIgnoredActivity probably should get called in the application class, while setting up lollipin.

So if your activity is called MyActivity the you would do lockManager.getAppLock().addIgnoredActivity(MyActivity.class);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants