我偶尔会收到以下异常。这种情况发生得很少,以至于我无法弄清可能触发它的任何情况 - 我主要在其他用户的Flurry例外报告中看到它。它可能与切换和返回活动有关(例如使用主页按钮),但这只是一个猜测。ImageView导致android.graphics.Canvas.throwIfRecycled异常
class java.lang.RuntimeException android.graphics.Canvas.throwIfRecycled:955 (Canvas: trying to use a recycled bitmap [email protected])
完全logcat的倾倒在这里:http://pastebin.com/2RjjgWHH
我已经通过相关的问题看,但他们都不适用。事情是,我没有手动回收任何位图。我没有加载大型位图或操作位图。我有一个单,微小ImageView
在我的整个应用程序图标,从XML布局加载,我不对它做任何事,除了编程用于切换含LinearLayout
VISIBLE
和GONE
之间。基本上应用程序中唯一的其他内容是两个WebView
s,一个TextView
和一个ProgressDialog
。
<ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/icon_a" android:focusableInTouchMode="false" android:focusable="false" android:layout_gravity="center_horizontal"></ImageView>
是否有你需要用ImageView
做以防止它被回收,或检查并刷新它,如果回收利用,VISIBLE
和GONE
之间切换时,一些特别的东西?大多数时候它完美地工作。
运行进一步的测试后,它似乎甚至不是我的ImageView导致的问题。除非WebView使用ImageViews来实现某些功能,否则我想这可能与AdMob代码或类似代码有关。 – 2011-06-18 12:05:56