1
我正在使用应用程序获取gps位置,并将其绘制为位图上的圆圈,然后将其保存以继续,因此我需要重复读取并保存该文件。但不幸的是,当我保存文件并读取它时,文件在一些迭代之后被损坏......!
的代码:包括
bitmap.compress破坏图片质量
File output = new File(tmpDirectory, "map.jpg");
try {
OutputStream outputStream = new FileOutputStream(output);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
outputStream.flush();
outputStream.close();
} catch (Exception ex) {
Message("error!");
}
directory = tmpDirectory;//updating directory to load the manipulated image
readFile(directory + "map.jpg", false);//setting the image view new image
图像:包含picture after iterations 图像: main image
“我使用一个应用程序来获取GPS位置,并绘制成一个位图一个圆,然后将其保存到前进,所以我需要重复读取和保存文件” - 为什么你需要到“重复读取和保存文件”?你已经有了'位图'。您不需要再次阅读它以使用该“位图”。 – CommonsWare