E/AndroidRuntime: FATAL EXCEPTION: main Process: com.zhbit.order, PID: 16341 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=4, result=-1, data=Intent { (has extras) }} to activity {com.zhbit.order/com.zhbit.order.activity.MyActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.flush()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:4092) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4135) at android.app.ActivityThread.-wrap20(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1536) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6176) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.flush()' on a null object reference at com.zhbit.order.activity.MyActivity.setPicToView(MyActivity.java:189) at com.zhbit.order.activity.MyActivity.onActivityResult(MyActivity.java:145) at android.app.Activity.dispatchActivityResult(Activity.java:6945)
时间: 2024-04-05 18:35:04 浏览: 162
bh-Android--java.rar_android_site:www.pudn.com_抢滩登陆Java
这是一个 Android 运行时异常,主要原因是在调用 `setPicToView()` 方法时,空对象引用了 `OutputStream` 的 `flush()` 方法。具体来说,可能是在 `setPicToView()` 方法中使用了一个未初始化的 `OutputStream` 对象,或者是在调用 `flush()` 方法之前,该对象已经被关闭或释放了。这种情况下,你需要检查 `setPicToView()` 方法的实现,并确保 `OutputStream` 对象被正确地初始化并符合要求。如果问题仍然存在,请提供更多的代码信息,以便能够更好地帮助你解决问题。
阅读全文