1. 理解“can't compress a recycled bitmap”的含义 “can't compress a recycled bitmap” 是一个在 Android 开发中常见的错误提示,意味着你尝试对一个已经被回收(recycled)的 Bitmap 对象进行压缩操作。由于 Bitmap 对象已被回收,其内存资源已被释放,因此无法进行任何操作,包括压缩。 2. 查找关于bitmap压缩...
java.lang.IllegalStateException: Can't compress a recycled bitmap 解决: View drawingView = get_your_view_for_render; drawingView.buildDrawingCache(true); Bitmap bitmap = drawingView.getDrawingCache(true).copy(Config.RGB_565, false); drawingView.destroyDrawingCache(); // bitmap is now OK for...
publicbooleancompress(CompressFormat format,intquality, OutputStream stream){ checkRecycled("Can't compress a recycled bitmap"); //省略代码 returnresult; } //如果位图已被回收,则希望抛出异常的方法将调用此值。 privatevoidcheckRecycled(String errorMessage){ if(mRecycled) { thrownewIllegalStateException...