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

NullpointerException #3

Open
daimajia opened this issue Apr 5, 2014 · 1 comment
Open

NullpointerException #3

daimajia opened this issue Apr 5, 2014 · 1 comment

Comments

@daimajia
Copy link

daimajia commented Apr 5, 2014

I test this in Nexus 5 Android 4.4.2, when I try to select a image from the Photo.

E/BitmapFactory(12277): Unable to decode stream: java.lang.NullPointerException
E/AndroidRuntime(12277): FATAL EXCEPTION: main
E/AndroidRuntime(12277): Process: com.lightbox.android.photoprocessing, PID: 12277
E/AndroidRuntime(12277): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://com.google.android.gallery3d.provider/picasa/item/5998237931599187714 flg=0x1 }} to activity {com.lightbox.android.photoprocessing/com.lightbox.android.photoprocessing.PhotoProcessingActivity}: java.lang.IllegalArgumentException: filename cannot be null
E/AndroidRuntime(12277):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3365)
E/AndroidRuntime(12277):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3408)
E/AndroidRuntime(12277):    at android.app.ActivityThread.access$1300(ActivityThread.java:135)
E/AndroidRuntime(12277):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
E/AndroidRuntime(12277):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(12277):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(12277):    at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime(12277):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12277):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(12277):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime(12277):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime(12277):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(12277): Caused by: java.lang.IllegalArgumentException: filename cannot be null
E/AndroidRuntime(12277):    at android.media.ExifInterface.<init>(ExifInterface.java:121)
E/AndroidRuntime(12277):    at com.lightbox.android.photoprocessing.utils.MediaUtils.getExifOrientation(MediaUtils.java:48)
E/AndroidRuntime(12277):    at com.lightbox.android.photoprocessing.PhotoProcessingActivity.loadPhoto(PhotoProcessingActivity.java:533)
E/AndroidRuntime(12277):    at com.lightbox.android.photoprocessing.PhotoProcessingActivity.onActivityResult(PhotoProcessingActivity.java:223)
E/AndroidRuntime(12277):    at android.app.Activity.dispatchActivityResult(Activity.java:5423)
E/AndroidRuntime(12277):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3361)
E/AndroidRuntime(12277):    ... 11 more
@vvit
Copy link

vvit commented May 9, 2017

Try asking the permission first.

if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
    // Import photo
}
else {
    ActivityCompat.requestPermissions(activity, new String[]{READ_EXTERNAL_STORAGE}, 100);
}

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