Android trying to use a recycled bitmap, not in my code

前端 未结 6 1377
滥情空心
滥情空心 2020-12-30 00:56

I get this stacktrace from the Market developer console every once in a while; I can\'t find any way to repro the error. It\'s happening while displaying a splashscreen Imag

6条回答
  •  青春惊慌失措
    2020-12-30 01:00

    If you recycle your bitmap somewhere in your code, you should be sure that, when the app restart, your bitmap would be recreated. When you pass through the onCreate, no issues, but when the app is in pause and restarted it will not pass through the onCreate again, just through the onResume. I think you could recreate your bitmaps in the onResume method, but use a flag to create the bitmap in the onCreate or in the onResume, not both (onCreate and onResume are called together when the app starts and you could waste CPU cycles).

提交回复
热议问题