android-multipicker-library
android-multipicker-library copied to clipboard
NullPointerException
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference
at android.support.v4.content.ContextCompat.checkSelfPermission(ContextCompat.java:453)
at com.kbeanie.multipicker.utils.FileUtils.checkForExternalStorageRuntimePermission(FileUtils.java:94)
at com.kbeanie.multipicker.utils.FileUtils.getExternalFilesDirectory(FileUtils.java:32)
at com.kbeanie.multipicker.core.threads.FileProcessorThread.getTargetDirectory(FileProcessorThread.java:494)
at com.kbeanie.multipicker.core.threads.FileProcessorThread.getTargetLocationToCopy(FileProcessorThread.java:557)
at com.kbeanie.multipicker.core.threads.FileProcessorThread.copyFileToFolder(FileProcessorThread.java:143)
at com.kbeanie.multipicker.core.threads.FileProcessorThread.postProcess(FileProcessorThread.java:130)
at com.kbeanie.multipicker.core.threads.FileProcessorThread.processFiles(FileProcessorThread.java:106)
at com.kbeanie.multipicker.core.threads.FileProcessorThread.run(FileProcessorThread.java:79)
at com.kbeanie.multipicker.core.threads.ImageProcessorThread.run(ImageProcessorThread.java:41)
using latest version of library
@coomar2841 there is no way of reproducing this error on my side. Any idea under what circumstances this could happen?
@virengujariya The activity or service where you are calling the library methods with context could be destroyed. So as context passed is null or became null by the time using it in checkPermission method, it is throwing that error.
For Android 6.0 onwards you need to have storage permission before using this feature. So, I think this crash is related to permission not granted to you for storage. First, ask for the permission and then pick any of the media