我有一个问题。我从我自己的应用程序开始使用Photo-Intent构建内置PhotoApplication。图片不会保存在三星Nexus
String photoName = System.currentTimeMillis() + ".jpg";
File file = new File(getFilesDir(),//Environment.getExternalStoragePublicDirectory(
//Environment.DIRECTORY_DCIM),
photoName); // Anlegen der Datei im entsprechenden
// Verzeichnis
FileOutputStream fos = null;
try {
fos = openFileOutput(photoName, Context.MODE_WORLD_WRITEABLE);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
fos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
outputFileUri = Uri.fromFile(file);
intentPhoto.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
//startActivity(intentPhoto);
startActivityForResult(intentPhoto, TAKE_PICTURE);
这是我的代码来启动活动。正如你所看到的,我做的第一件事是在目录中设置文件,然后给出文件位置的意图来存储它。
但是我每次拍照时都不会保存到图片目录中。保存图片的唯一方法是关闭手机并重新启动。然后,我所拍的每张照片都在那里。这发生在自上次更新至4.1.1以来。贝福我更新了手机,一切正常,但自更新后,我有这个问题。
有人可以帮我吗?有没有人有同样的问题?
澄清,当你说“三星Nexus”的意思是“Nexus S”或“Galaxy Nexus”?两者都由三星制造。 – FoamyGuy 2012-07-20 14:12:38
或Nexus平板电脑? – m0skit0 2012-07-20 14:45:13
当您尝试关闭文件时,是否有任何异常被抛出? IE浏览器。你看到任何堆栈跟踪打印出来了吗? – slayton 2012-07-20 14:46:13