I am trying to draw lines in my app. After it is done, i want to save the screen as an image. But i don't want the button to be in the image. I want to crop it and then save it. I have tried to use this code to crop my bitmap in onclicklistener. But it didn't work. Bitmap.createBitmap(bitmap, 5, 5, 5, 5); this is my all code:
content.setDrawingCacheEnabled(true);
content.buildDrawingCache();
Bitmap bitmap = Bitmap.createBitmap(content.getDrawingCache()); // Bitmap
Bitmap.createBitmap(bitmap, 5, 5, 5, 5);
content.setDrawingCacheEnabled(false);
File file = new File("/sdcard/SurucuImza.jpg");
FileOutputStream ostream = null;
try {
if (bitmap != null) {
file.createNewFile();
ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.JPEG, 100, ostream);
ostream.flush();
ostream.close();
}
} catch (Exception e) {
e.printStackTrace();
}
bitmap.recycle();
bitmap = null;
ostream = null;
content.setDrawingCacheEnabled(false);
}