当前位置: 代码迷 >> Android >> 请问:执行canvas.setBit地图(bt)出错,异常提示如上:java.lang.IllegalStateException
  详细解决方案

请问:执行canvas.setBit地图(bt)出错,异常提示如上:java.lang.IllegalStateException

热度:246   发布时间:2016-05-01 17:35:32.0
请教:执行canvas.setBitmap(bt)出错,错误提示如下:java.lang.IllegalStateException
FATAL EXCEPTION: main
  java.lang.IllegalStateException
  at android.graphics.Canvas.setBitmap(Canvas.java:144)
  at com.zl.android.game.LogoImp.onDraw(LogoImp.java:64)
  at android.view.View.draw(View.java:6740)
  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
  at android.view.View.draw(View.java:6743)
  at android.widget.FrameLayout.draw(FrameLayout.java:352)
  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
  at android.view.View.draw(View.java:6743)
  at android.widget.FrameLayout.draw(FrameLayout.java:352)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842)
  at android.view.ViewRoot.draw(ViewRoot.java:1407)
  at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:4627)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  at dalvik.system.NativeStart.main(Native Method)


------解决方案--------------------
at android.graphics.Canvas.setBitmap(Canvas.java:144)
at com.zl.android.game.LogoImp.onDraw(LogoImp.java:64)

LogoImp类的64行有错哦,非法状态
  相关解决方案