Android学习之保存Bitmap到指定目录

/**
	 * 保存图片到指定目录
	 * 
	 * @param bmp
	 * @param filename
	 * @return
	 */
	private boolean saveBitmapTofile(Bitmap bmp, String filename) {
		if (bmp == null || filename == null)
			return false;
		CompressFormat format = Bitmap.CompressFormat.JPEG;
		int quality = 100;
		OutputStream stream = null;
		try {
			stream = new FileOutputStream("/sdcard/myimage/" + filename);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bmp.compress(format, quality, stream);
	}

转载于:https://www.cnblogs.com/jzdwajue/p/7110948.html

你可能感兴趣的:(Android学习之保存Bitmap到指定目录)