Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onError in Fragment called too soon causing NPE #138

Open
fliespl opened this issue Dec 9, 2015 · 1 comment
Open

onError in Fragment called too soon causing NPE #138

fliespl opened this issue Dec 9, 2015 · 1 comment

Comments

@fliespl
Copy link

fliespl commented Dec 9, 2015

On some devices returning to fragment with image chooser could lead to NPE (either error or success).

This is because onError is called before activity is available to fragment (getActivity() is still null).

Fatal Exception: java.lang.NullPointerException
at xxx.com.SomeFragment.onError(SomeFragment.java:252)
at com.kbeanie.imagechooser.api.ImageChooserManager.onError(ImageChooserManager.java:309)
at com.kbeanie.imagechooser.threads.ImageProcessorThread.run(ImageProcessorThread.java:57)

@coomar2841
Copy link
Owner

In these circumstances, you should be re-initializing the chooser managers. Can you try the sample app and see if they work for your. There's a fragment option which shows how to handle in a fragment.

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

No branches or pull requests

2 participants