I have one problem in converting relativelayout to Bitmap in android.
In onCreate(), I have already converted the relativelayout to Bitmap. (The relativelayout inclue the imageview and the other view) And then I want to convert the relavielayout to Bitmap again after I change the image of the ImageView. But the result is same to last converted image result.
The code :
v = (RelativeLayout) findViewById(R.id.relative_layout_id);
v.setDrawingCacheEnabled(true);
v.measure(View.MeasureSpec.makeMeasureSpec(0,View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0, view.MeasureSpec.UNSPECIFIED));
v.layout(0, 0, share_screen.getMeasuredWidth(), share_screen.getHeight());
v.buildDrawingCache(true);
Bitmap b = Bitmap.createBitmap(share_screen.getDrawingCache());
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.PNG, 100, bytes);
image_view.setImageBitmap(b);