我想在内部存储器(不是外部存储器)存储 bitmap图像。我使用以下代码但是不能实现。因为当我从DDMS中下载图像,我不能打开图像。如何在内部存储器中存储图像?
public String writeFileToInternalStorage(Context context, Bitmap outputImage) {
String fileName = Long.toString(System.currentTimeMillis()) + ".png";
try {
OutputStreamWriter osw = new OutputStreamWriter(context.openFileOutput(fileName, Context.MODE_PRIVATE));
osw.write(outputImage.toString());
Log.i(TAG, "Image stored at: " + fileName);
} catch (Exception e) {
Log.w(TAG, e.toString());
fileName = null;
}
return fileName;
}