我想从AndroidPlot中保存一个.png图像

use*_*167 4 png android bitmap android-layout androidplot

我编写了一个绘制线图的代码.此图表是使用Android Plot绘制的.如何将此图表另存为.png图像?

小智 5

        xyPlot.setDrawingCacheEnabled(true);
        int width = xyPlot.getWidth();
        int height = xyPlot.getHeight();
        xyPlot.measure(width, height);
        Bitmap bmp = Bitmap.createBitmap(xyPlot.getDrawingCache());
        xyPlot.setDrawingCacheEnabled(false);
        FileOutputStream fos = new FileOutputStream(fullFileName, true);
        bmp.compress(CompressFormat.JPEG, 100, fos);
Run Code Online (Sandbox Code Playgroud)