关闭

androird textview trying to use a recycled bitmap android.graphics

标签: textviewcanvasandroid
172人阅读 评论(4) 收藏 举报
分类:

近期写android碰上一个textview的奇葩问题,求各路大神入住


java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@2e09f030

08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1282)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.graphics.Canvas.drawBitmap(Canvas.java:1416)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:539)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.widget.TextView.onDraw(TextView.java:5414)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.View.draw(View.java:15305)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.View.draw(View.java:15214)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.drawChild(ViewGroup.java:3414)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3205)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.View.draw(View.java:15308)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.View.draw(View.java:15214)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.drawChild(ViewGroup.java:3414)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3205)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.View.draw(View.java:15212)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.drawChild(ViewGroup.java:3414)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3205)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.View.draw(View.java:15212)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.drawChild(ViewGroup.java:3414)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3205)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.View.draw(View.java:15212)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.drawChild(ViewGroup.java:3414)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3205)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.View.draw(View.java:15308)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.widget.FrameLayout.draw(FrameLayout.java:598)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2674)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2779)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewRootImpl.draw(ViewRootImpl.java:2685)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2425)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2048)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1105)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6204)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:799)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.Choreographer.doCallbacks(Choreographer.java:612)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.Choreographer.doFrame(Choreographer.java:581)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.view.Choreographer$FrameHandler.handleMessage(Choreographer.java:714)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.os.Looper.loop(Looper.java:135)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5669)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
08-29 15:43:52.889 26558-26558/com.BDB.bdbconsumer W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
0
0
查看评论

完美解决 trying to use a recycled bitmap android.graphics.Bitmap@41d的异常

在最近一个项目中,因为要使用AnimationDrawable进行动画播放,图片质量都比较大,而且播放的频率会很多,开发的行车记录仪的内存又有限,刚开始并没有将Bitmap recycle掉,所以出现了OOM的异常。为了解决内存溢出问题,在退出当前页面的时候,将Bitmap recycle掉。但是在...
  • VIPqiangqiang
  • VIPqiangqiang
  • 2017-03-06 17:13
  • 3899

Android手动回收bitmap,引发Canvas: trying to use a recycled bitmap处理

转自:http://zwnjava.iteye.com/blog/1901880  在做Android的开发的时候,在ListView 或是 GridView中需要加载大量的图片,为了避免加载过多的图片引起OutOfMemory错误,设置了一个图片缓存列表 Ma...
  • primer_programer
  • primer_programer
  • 2014-05-23 13:42
  • 21368

Gesture控制图片缩放&Canvas: trying to use a recycled bitmap android.graphics.Bitmap异常

今天刚学了Gesture手势~就写了一个“根据手势来进行图片缩放”的例子来巩固知识。 大致步骤: 1. 创建 Activity并且实现OnGestureListener接口 2. 定义手势检测器实例等。 3. 实现Activity的onTouchEvent()方法,将触控事件交给手势检测器来处理...
  • u014253480
  • u014253480
  • 2016-01-31 00:00
  • 1143

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap:报错解决

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap:报错解决
  • meizivskai
  • meizivskai
  • 2017-07-12 23:59
  • 603

Canvas: trying to use a recycled bitmap android.graphics.Bitmap@XXX

最近在做和图片相关显示的出现了一个问题,整理一下思路,分享出来给大家参考一下: Exception Type:java.lang.RuntimeException java.lang.RuntimeException: Canvas: trying to use a recycled bitm...
  • sex_34
  • sex_34
  • 2015-08-17 15:48
  • 3739

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap...

出现此bug的原因是在内存回收上,里面用Bitamp的代码为: top=(ImageView)view.findViewById(R.id.top); bitmap=ImgBitmap.comeFromRes(getResources(), R.drawable. top); ...
  • jerry5213
  • jerry5213
  • 2015-11-25 13:58
  • 483

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@412d7230

最近遇到了如标题这样的错误,再次记录解决方法。本文参考帖子: http://bbs.csdn.net/topics/390196217 出现此bug的原因是在内存回收上,里面用Bitamp的代码为: top=(ImageView)view.findViewById(R.id.top); bit...
  • gc_gongchao
  • gc_gongchao
  • 2014-09-30 17:53
  • 4873

关于bitmap recycle trying to use a recycled bitmap android.graphics.Bitmap

在开发中,一直使用4.0以上手机作为测试机所以一直没有出现这个问题,今天换了2.3版本的手机,出现了这个错误: trying to use a recycled bitmap android.graphics.Bitmap 后检查代码,我的图片回收代码是介个样子的: public ...
  • fkepgydhbyuan
  • fkepgydhbyuan
  • 2015-07-21 10:51
  • 2502

Bitmap回收—Canvas: trying to use a recycled bitmap android.graphics

bitmap 回收时 /**  * onDestroy方法  * */ @Override protected void onDestroy() { super.onDestroy(); BitmapToBase.recycleBitmap(bitmap...
  • weixin_37730482
  • weixin_37730482
  • 2017-06-03 11:22
  • 385

有关Bitmap使用时报错 Canvas: trying to use a recycled bitmap

操作步骤及现象: 应用程序在播放视频时点击Home键,应用程序被主页覆盖,运行于后台,再一次点击应用程序图标,程序崩溃,报错如下: FATAL EXCEPTION: main java.lang.RuntimeException: Canvas: trying to use a recy...
  • Sunnyfans
  • Sunnyfans
  • 2013-02-25 09:19
  • 15288
    个人资料
    • 访问:173次
    • 积分:11
    • 等级:
    • 排名:千里之外
    • 原创:1篇
    • 转载:0篇
    • 译文:0篇
    • 评论:4条
    文章分类
    文章存档
    最新评论