1

java.lang.RuntimeException当我尝试选择将图像从画廊存储到 imageview 时,我得到了。我正在使用两个意图。

1.拍照并存储在imageview
2.从图库中选择

但是,当我使用此代码MainActivity.java时,我在存储相机图像时遇到异常,而当我使用此代码MainActivity.java时,则在存储画廊图像时出现错误。这些代码有什么问题。

如果它适用于相机图像,那么它不适用于画廊,如果它适用于画廊,那么它不适用于相机图像。为什么?

这是我设置相机图像的日志猫。

08-30 17:37:57.218: E/AndroidRuntime(8877): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { act=inline-data (has extras) }} to activity {org.inextrix.userprofile/org.inextrix.userprofile.MainActivity}: java.lang.NullPointerException
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2536)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:2578)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.access$2000(ActivityThread.java:117)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:965)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.os.Looper.loop(Looper.java:130)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.main(ActivityThread.java:3687)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at java.lang.reflect.Method.invokeNative(Native Method)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at java.lang.reflect.Method.invoke(Method.java:507)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at dalvik.system.NativeStart.main(Native Method)
08-30 17:37:57.218: E/AndroidRuntime(8877): Caused by: java.lang.NullPointerException
08-30 17:37:57.218: E/AndroidRuntime(8877):     at org.inextrix.userprofile.MainActivity.onActivityResult(MainActivity.java:77)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.Activity.dispatchActivityResult(Activity.java:3908)
08-30 17:37:57.218: E/AndroidRuntime(8877):     at android.app.ActivityThread.deliverResults(ActivityThread.java:2532)
08-30 17:37:57.218: E/AndroidRuntime(8877):     ... 11 more

以前有人遇到过这个问题,或者我做错了什么。如果你有任何想法然后建议我
谢谢

4

1 回答 1

3

对于画廊的问题,我认为这应该您有所帮助。

于 2012-08-30T12:27:49.180 回答