Reputation:
So, basically i have next piece of code:
llPhotoTest.setDrawingCacheEnabled(false);
llPhotoTest.setDrawingCacheEnabled(true);
...
llPhotoTest.getDrawingCache();
First time everything is ok, but second time cached picture stay the same. I've seen a lot of solutions for this problem but nothing works for me. I would appreciate any help or suggestion. Thank you in advance
I've tried:
llPhotoTest.setDrawingCacheEnabled(true);
llPhotoTest.getDrawingCache();
llPhotoTest.setDrawingCacheEnabled(false);
Also I've tried
llPhotoTest.buildDrawingCache();
llPhotoTest.getDrawingCache();
llPhotoTest.destroyDrawingCache();
Still same picture :(
There is a layout bounds
Upvotes: 0
Views: 1277
Reputation:
Thanks to everybody! I found solution, that's was an Issue.
llPhotoTest.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
From documentation http://developer.android.com/reference/android/view/View.html#LAYER_TYPE_SOFTWARE:
Indicates that the view has a software layer. A software layer is backed by a bitmap and causes the view to be rendered using Android's software rendering pipeline, even if hardware acceleration is enabled.
Upvotes: 2
Reputation: 2614
That's not a good way to display a bitmap.
Use an ImageView
, not a LinearLayout
and call ImageView.setImageBitmap(Bitmap bm)
Upvotes: 0