0
I’m putting the screenshot function in the calendar, however the photo is not going as it should.
But using native android function comes out correct
Follows excerpt from the code:
View v1 = getActivity().findViewById(R.id.ScrollcalendarView);
v1.setDrawingCacheEnabled(true);
ScrollView z = (ScrollView) getActivity().findViewById(R.id.ScrollcalendarView);
int totalHeight = z.getChildAt(0).getHeight();
int totalWidth = z.getChildAt(0).getWidth();
v1.layout(0, 0, totalWidth, totalHeight);
Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
File imageFile = new File(mPath);
FileOutputStream outputStream = new FileOutputStream(imageFile);
int quality = 100;
bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
outputStream.flush();
outputStream.close();
openScreenshot(imageFile);
} catch (Throwable e) {
// Several error may come out with file handling or OOM
e.printStackTrace();
}
}
Does anyone have any idea what it might be?