Java 处理毕加索(重新)抛出的异常
有可能捕获这样的异常吗?我可以使用Thread.UncaughtExceptionHandler吗Java 处理毕加索(重新)抛出的异常,java,android,picasso,Java,Android,Picasso,有可能捕获这样的异常吗?我可以使用Thread.UncaughtExceptionHandler吗 java.lang.IllegalArgumentException: RemoteViews for widget update exceeds maximum bitmap memory usage (used: 1000000, max: 921600) The total memory cannot exceed that required to fill the device's scr
java.lang.IllegalArgumentException: RemoteViews for widget update exceeds maximum bitmap memory usage (used: 1000000, max: 921600) The total memory cannot exceed that required to fill the device's screen once.
at android.os.Parcel.readException(Parcel.java:1429)
at android.os.Parcel.readException(Parcel.java:1379)
at com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.updateAppWidgetIds(IAppWidgetService.java:523)
at android.appwidget.AppWidgetManager.updateAppWidget(AppWidgetManager.java:333)
at com.squareup.picasso.RemoteViewsAction$AppWidgetAction.update(RemoteViewsAction.java:99)
at com.squareup.picasso.RemoteViewsAction.complete(RemoteViewsAction.java:43)
at com.squareup.picasso.Picasso.deliverAction(Picasso.java:511)
at com.squareup.picasso.Picasso.complete(Picasso.java:470)
at com.squareup.picasso.Picasso$1.handleMessage(Picasso.java:115)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4963)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(NativeStart.java)
我看到毕加索正在使用Handler抛出异常:
Picasso.HANDLER.post(new Runnable() { ...
是否可以从我的代码中捕获此异常?在开发者网站: RemoteView对象使用的位图内存总量不能超过 填充屏幕1.5倍所需的,即(屏幕宽度x屏幕 高度x 4 x 1.5)字节 在您的特定情况下,当从流加载的位图大于可能值时,会发生错误 你需要解码后的图像比较为适当的大小为您的布局 或者通过毕加索图书馆上的
.resize(imageWidth,imageHight)
希望这有帮助:) 我已经做过了(我忘了添加resize),但我只是好奇是否有可能捕获毕加索抛出到主线程的异常。我希望避免此错误并不会使我的应用程序崩溃;-)那么,试一试{..}catch(异常e){e.printStackTrace();}嗯??!由于毕加索在图像不在缓存中的情况下异步加载图像,因此无法从代码中捕获图像的异常。如果您在主线程上设置了一个全局
UncaughtExceptionHandler
,那么您当然可以捕获所有未检查的异常并根据需要处理它们。