/** * Saves the current chart state with the given name to the given path on * the sdcard leaving the path empty "" will put the saved file directly on * the SD card chart is saved as a PNG image, example: * saveToPath("myfilename", "foldername1/foldername2"); * * @param title * @param pathOnSD e.g. "folder1/folder2/folder3" * @return returns true on success, false on error */ public boolean saveToPath(String title, String pathOnSD) { Bitmap b = getChartBitmap(); OutputStream stream = null; try { stream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() + pathOnSD + "/" + title + ".png"); /* * Write bitmap to file using JPEG or PNG and 40% quality hint for * JPEG. */ b.compress(CompressFormat.PNG, 40, stream); stream.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
out = new FileOutputStream(filePath); Bitmap b = getChartBitmap(); b.compress(format, quality, out);
/** * Saves the current chart state with the given name to the given path on * the sdcard leaving the path empty "" will put the saved file directly on * the SD card chart is saved as a PNG image, example: * saveToPath("myfilename", "foldername1/foldername2"); * * @param title * @param pathOnSD e.g. "folder1/folder2/folder3" * @return returns true on success, false on error */ public boolean saveToPath(String title, String pathOnSD) { Bitmap b = getChartBitmap(); OutputStream stream = null; try { stream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() + pathOnSD + "/" + title + ".png"); /* * Write bitmap to file using JPEG or PNG and 40% quality hint for * JPEG. */ b.compress(CompressFormat.PNG, 40, stream); stream.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
/** * Saves the current chart state with the given name to the given path on * the sdcard leaving the path empty "" will put the saved file directly on * the SD card chart is saved as a PNG image, example: * saveToPath("myfilename", "foldername1/foldername2"); * * @param title * @param pathOnSD e.g. "folder1/folder2/folder3" * @return returns true on success, false on error */ public boolean saveToPath(String title, String pathOnSD) { Bitmap b = getChartBitmap(); OutputStream stream = null; try { stream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() + pathOnSD + "/" + title + ".png"); /* * Write bitmap to file using JPEG or PNG and 40% quality hint for * JPEG. */ b.compress(CompressFormat.PNG, 40, stream); stream.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
/** * Saves the current chart state with the given name to the given path on * the sdcard leaving the path empty "" will put the saved file directly on * the SD card chart is saved as a PNG image, example: * saveToPath("myfilename", "foldername1/foldername2"); * * @param title * @param pathOnSD e.g. "folder1/folder2/folder3" * @return returns true on success, false on error */ public boolean saveToPath(String title, String pathOnSD) { Bitmap b = getChartBitmap(); OutputStream stream = null; try { stream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() + pathOnSD + "/" + title + ".png"); /* * Write bitmap to file using JPEG or PNG and 40% quality hint for * JPEG. */ b.compress(CompressFormat.PNG, 40, stream); stream.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
/** * Saves the current chart state with the given name to the given path on * the sdcard leaving the path empty "" will put the saved file directly on * the SD card chart is saved as a PNG image, example: * saveToPath("myfilename", "foldername1/foldername2"); * * @param title * @param pathOnSD e.g. "folder1/folder2/folder3" * @return returns true on success, false on error */ public boolean saveToPath(String title, String pathOnSD) { Bitmap b = getChartBitmap(); OutputStream stream = null; try { stream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() + pathOnSD + "/" + title + ".png"); /* * Write bitmap to file using JPEG or PNG and 40% quality hint for * JPEG. */ b.compress(CompressFormat.PNG, 40, stream); stream.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
out = new FileOutputStream(filePath); Bitmap b = getChartBitmap(); b.compress(format, quality, out);
out = new FileOutputStream(filePath); Bitmap b = getChartBitmap(); b.compress(format, quality, out);
out = new FileOutputStream(filePath); Bitmap b = getChartBitmap(); b.compress(format, quality, out);
out = new FileOutputStream(filePath); Bitmap b = getChartBitmap(); b.compress(format, quality, out);