当我使用SimpleDraweeView显示本地图像时,出现了问题
Uri uri = Uri.parse("file://"+data);
simpleDraweeView.setImageURI(uri);
错误是
UncaughtException detected: java.lang.IllegalStateException
at com.facebook.common.internal.Preconditions.checkState(Preconditions.java:158)
at com.facebook.drawee.components.DeferredReleaser.ensureOnUiThread(DeferredReleaser.java:101)
at com.facebook.drawee.components.DeferredReleaser.cancelDeferredRelease(DeferredReleaser.java:96)
at com.facebook.drawee.controller.AbstractDraweeController.onAttach(AbstractDraweeController.java:358)
at com.facebook.drawee.view.DraweeHolder.attachController(DraweeHolder.java:264)
at com.facebook.drawee.view.DraweeHolder.attachOrDetachController(DraweeHolder.java:281)
at com.facebook.drawee.view.DraweeHolder.onAttach(DraweeHolder.java:93)
at com.facebook.drawee.view.DraweeView.doAttach(DraweeView.java:180)
at com.facebook.drawee.view.DraweeView.onAttach(DraweeView.java:166)
at com.facebook.drawee.view.DraweeView.onAttachedToWindow(DraweeView.java:140)
at android.view.View.dispatchAttachedToWindow(View.java:14798)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2969)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2969)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2969)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2969)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1618)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1340)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6809)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:894)
at android.view.Choreographer.doCallbacks(Choreographer.java:696)
at android.view.Choreographer.doFrame(Choreographer.java:631)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
我不知道那是什么错误。uri有效。
答案 0 :(得分:0)
只允许您从UI线程中更新视图,而不能从其他线程中更新视图。您可以通过从UI线程更新组件来解决该异常:
async