当我尝试选择将图像从图库存储到imageview时,我得到java.lang.RuntimeException
。我正在使用两个意图。
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
之前有人遇到过这个问题,或者我做错了什么。如果你有任何想法,那么建议我谢谢