Integer val = myReceipt.receiptId ;
String fileName = "image" + "_" + title.getText().toString()+"_" + val.toString();
photo = this.createTemporaryFile(fileName, ".jpg");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
uriOfPhoto = Uri.fromFile(photo);
startActivityForResult(intent, RESULT_CAMERA_SELECT);
}
}
private File createTemporaryFile(String part, String ext) throws Exception
{
File tempDir = new File (Environment.getExternalStorageDirectory() + "/Catch All Keeper/Receipts");
if(!tempDir.exists())
{
tempDir.mkdir();
}
tempDir.canWrite();
return File.createTempFile(part, ext, tempDir);
}
});
我用上面的代码应该给出文件名image_title_val,但是却给出一个奇怪的名字image_title_(some random numbers).jpg。
为什么出现这个问题?