sami
sami

Reputation: 11

drawing cache returns the same Image

i have problem with frame layout drawing cache. i capture the video from camera and display it in frame layout. i want to read this image(s) and send it to another client with TCP or UDP. now the problem is the cache dosent update and i have the same image (complete black image) always here is my code:

selfImage.setDrawingCacheEnabled(true);
selfImage.buildDrawingCache();
mainImage = selfImage.getDrawingCache();
Bitmap bmp = mainImage.copy(Bitmap.Config.ARGB_8888,false);
streamImage.reset();
bmp.compress(Bitmap.CompressFormat.JPEG, 50, streamImage);
Bitmap temp = bmp;
runOnUiThread(new uiInterface(12, temp));
sendVideo(streamImage);
selfImage.destroyDrawingCache();
mainImage.recycle();
selfImage.setDrawingCacheEnabled(false);

self image is my frame layout! please help me. thanks

Upvotes: 0

Views: 308

Answers (1)

inhogo
inhogo

Reputation: 273

I used this code. It works in my case.

setDrawingCacheEnabled(true); destroyDrawingCache(); return getDrawingCache();

Upvotes: 2

Related Questions