I wrote some code witch can to convert tablelayout to bitmap.everythink working perfect but, my bitmap has black background this is a my source code
public Bitmap sendMyData(TableLayout view) {
Bitmap bitmap = null;
ByteArrayOutputStream bbb = new ByteArrayOutputStream();
view.setDrawingCacheEnabled(true);
view.layout(0, 0, view.getWidth(), view.getHeight());
view.buildDrawingCache(true);
bitmap = Bitmap.createBitmap(view.getDrawingCache());
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bbb);
view.setDrawingCacheEnabled(false);
return bitmap;
}
what 's wrong in my code?why my bitmap has black background? if anyone knows solution please help me thanks
JPEG format must have background color.So when you convert PNG image or icon to JPEG, replace the transparent background with black color.
convert it as PNG. bitmap.compress(Bitmap.CompressFormat.PNG, 100, bbb);