我有我的bitmap
和I want to convert my bitmap to save as image in another new file by below code.
注意:它在除 Galaxy S3 之外的所有设备上都能正常工作。任何人都可以帮助我使此代码在 S3 中可用。我总是在转换为新文件时得到这个 Toast。任何人都知道可能会发生什么问题。
Bitmap photo = (Bitmap) extras.get("data");
selectedImagePath = String.valueOf(System.currentTimeMillis())
+ ".jpg";
Log.i("TAG", "new selectedImagePath before file "
+ selectedImagePath);
File file = new File(Environment.getExternalStorageDirectory(),
selectedImagePath);
try {
file.createNewFile();
FileOutputStream fos = new FileOutputStream(file);
photo.compress(Bitmap.CompressFormat.PNG, 95, fos);
} catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(this,
"Sorry, Camera Crashed-Please Report as Crash A.",
Toast.LENGTH_LONG).show();
}
提前致谢。