嗨,大家好我正在使用相机应用程序窗体我的活动。使用下面的这一行,我试图将图像输出到我在SD卡上的指定位置。它不会将图像保存到它从getImageUri()获取的位置,而是将文件保存到相机gallery.any想法出了什么问题。相机不保存到指定的文件位置android
intent.putExtra(MediaStore.EXTRA_OUTPUT, getImageUri());
//my getImageUri
private Uri getImageUri() {
// Store image on sdcard
String dir= Environment.getExternalStorageDirectory() +"/my_app/Datapics";
File dirs = new File(dir);
if (!dirs.exists()) {
dirs.mkdirs();
}
Bundle extras = getIntent().getExtras();
CAPTURE_TITLE = extras.getString(some.NAME);
//EDIT if i add this line here
CAPTURE_TITLE= "whatever.png";
//it will save my picture to the folder i want it to save to but with name
//whatever.png i'm getting my name from my previous activity and want
//to assign it to capture title
File file = new File(dir , CAPTURE_TITLE+".jpg");
Uri imgUri = Uri.fromFile(file);
Log.e("get imageuri called: ",imgUri.toString());
//this is what I get from here
//04-28 19:42:33.835: E/get imageuri called:(2049):
//file:///mnt/sdcard/my_app/Datapics/BlackbirdSat%20Apr%2028%2019%3A42.jpg
Log.e("get imageuri called2: ",file.toString());
//this is what i get here
//04-28 19:42:33.835: E/get imageuri called2:(2049)
//:/mnt/sdcard/my_app/Datapics/BlackbirdSat Apr 28 19:42.jpg
return imgUri;
}
以及我条纹本次活动并创建了单独的应用程序,我将CAPTURE_TITLE指定为私有静态最终的应用程序,并将具有一个活动的应用程序将该文件保存到我想要的sdcard中。任何解决方法。 – 2012-04-28 23:10:55
哦,只是我的想象力,它没有最终 – 2012-04-28 23:17:54
所有的人我不知道这一点。名称不能包含:我正在使用包含的日期和时间来构建名称,所以我使用了新的Date()。toString()。replace(“:”,“”);并将我的照片保存到我的位置。 – 2012-04-29 00:59:38