Consider this code:
Image img = chart.getExport().getImage().image(WIDTH, HEIGHT);
I would expect it to return the actual bitmap using this code:
img.getBitmap();
However, that returns null! How come I cannot retrieve the underlying bitmap? How is it generated?
Try with bitmap
instead of getBitmap()
. The following code seems to work fine for me here:
Bar bar = new Bar(tChart1.getChart());
bar.fillSampleValues();
bar.setColorEach(true);
tChart1.doInvalidate();
Image img = tChart1.getExport().getImage().image(400, 200);
MediaStore.Images.Media.insertImage(getContentResolver(), img.bitmap, "test.jpg", "test.jpg");