我有 4 个活动 A、B、C 和 D。
活动 A 有一个菜单。它的一个选项打开具有列表视图的活动 D。Activity A 通过一个按钮打开 Activity B。Activity B 通过一个按钮打开 Activity C。
活动 C 有 4 个 ImageView,我在完成时回收它们。
当我执行以下场景时,一切都正常:
A -> B --back to--> A --click Menu to D --> OK
当我执行以下场景时,我得到了这个致命的异常:
A -> B -> C –back to--> B --back to--> A --click Menu to D --> get exception
活动 D 和 C 之间没有关系。但是为什么我在这里得到这个异常????
A->B->C (using buttons)
A-> D (using menu)
05-15 11:33:49.600: E/AndroidRuntime(2722): FATAL EXCEPTION: main
05-15 11:33:49.600: E/AndroidRuntime(2722): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@41326810
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1038)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.graphics.Canvas.drawBitmap(Canvas.java:1142)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:393)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.widget.ImageView.onDraw(ImageView.java:924)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.View.draw(View.java:10983)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.widget.ListView.drawChild(ListView.java:3223)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.widget.AbsListView.dispatchDraw(AbsListView.java:2092)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.widget.ListView.dispatchDraw(ListView.java:3218)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.View.draw(View.java:11088)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.widget.AbsListView.draw(AbsListView.java:3398)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.View.draw(View.java:10986)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.drawChild(ViewGroup.java:2885)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.View.draw(View.java:10986)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.widget.FrameLayout.draw(FrameLayout.java:450)
05-15 11:33:49.600: E/AndroidRuntime(2722): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2126)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2026)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.os.Handler.dispatchMessage(Handler.java:99)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.os.Looper.loop(Looper.java:137)
05-15 11:33:49.600: E/AndroidRuntime(2722): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-15 11:33:49.600: E/AndroidRuntime(2722): at java.lang.reflect.Method.invokeNative(Native Method)
05-15 11:33:49.600: E/AndroidRuntime(2722): at java.lang.reflect.Method.invoke(Method.java:511)
05-15 11:33:49.600: E/AndroidRuntime(2722): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-15 11:33:49.600: E/AndroidRuntime(2722): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-15 11:33:49.600: E/AndroidRuntime(2722): at dalvik.system.NativeStart.main(Native Method)