我已经回收了位图的变量,当我试图再次使用相同的变量,我有一些奇怪的错误,参照回收。任何解决这个问题?
image1.recycle(); 此搜索= NULL;
11月五号至29日:35:42.139:E / AndroidRuntime(695):java.lang.RuntimeException的:画布:试图用一个循环位图android.graphics.Bitmap@2bbad018
十一月5号至29号:35:42.139:E / AndroidRuntime(695):在android.graphics.Canvas.throwIfRecycled(Canvas.java:1038)
十一月5号至29号:35:42.139:E / AndroidRuntime(695):在android.graphics.Canvas.drawBitmap(Canvas.java:1078)
解决方案
在你回收的内存被释放的位图。这是否意味着位图数据从内存中消失了。如果你想再次使用相同的变量,你必须去$ C C的位图againg $。
如果(此搜索== NULL || image1.isRecycled()){
此搜索= BitmapFactory.de codeStream()
}
I have recycled the bitmap variable and when I again tried to use the same variable I have some strange errors with reference to recycle. Any solution to this issue ?
image1.recycle(); image1=null;
05-29 11:35:42.139: E/AndroidRuntime(695): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@2bbad018
05-29 11:35:42.139: E/AndroidRuntime(695): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1038)
05-29 11:35:42.139: E/AndroidRuntime(695): at android.graphics.Canvas.drawBitmap(Canvas.java:1078)
解决方案
Once you recycle the bitmap its memory is freed. That's mean that bitmaps data are gone from the memory. If you want to use again the same variable you have to decode the Bitmap againg .
if (image1 == null || image1.isRecycled()) {
image1 = BitmapFactory.decodeStream()
}
上一篇:致命异常:主要java.lang.VerifyError异常、java、VerifyError、lang
下一篇:的java.net.UnknownHostException无法解析主机主机、java、net、UnknownHostException