사진을 찍는 곳의 andorid 용 앱을 개발 중입니다. 문제는 필자가 conseguidor 현재 시간을 밀리 초 단위로 저장하고 현재 날짜 (dd/mm/yyyy)를 넣고 싶다는 것입니다.사진의 이름 지정 (날짜)
이 내 코드입니다 :
PictureCallback jpegCallback = new PictureCallback()
{
public void onPictureTaken(byte[] data, Camera camera)
{
FileOutputStream outStream = null;
try
{
outStream = new FileOutputStream(String.format("/mnt/extSdCard/Photos/%d.jpg", System.currentTimeMillis()));
outStream.write(data);
outStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
}
};
내가이를 넣어 시도하지만 오류가 얻을 작동하지 않습니다
사람이 MEP 도와 드릴까요Calendar c = Calendar.getInstance();
String day = Integer.toString(c.get(Calendar.DATE));
String month = Integer.toString(c.get(Calendar.MONTH));
String year = Integer.toString(c.get(Calendar.YEAR));
String name = day + "/" + month + "/" + year + ".jpg";
String folder = "/mnt/extSdCard/Photos/";
String path = folder + name;
...
outStream = new FileOutputStream(String.format(path));
outStream.write(data);
outStream.close();
를?
어디에서 오류가 발생합니까? 오류가 무엇입니까? – RvdK
디버거에 파일과 비슷한 내용이 없습니다. – wiki
02-26 15 : 55 : 54.117 : W/System.err (10701) : java.io.FileNotFoundException :/mnt/extSdCard/Potos/26/1/2013 .jpg : 열지 못했습니다 : ENOENT (해당 파일 또는 디렉토리 없음) 02-26 15 : 55 : 54.117 : W/System.err (10701) : \t at java.io.FileOutputStream. (FileOutputStream.java:88) 02-26 15 : 55 : 54.117 : W/System.err (10701) : \t at java.io.FileOutputStream. (FileOutputStream.java:128) 02-26 15 : 55 : 54.117 : W/System.err (10701) : \t at java.io.FileOutputStream. (FileOutputStream.java:117) 02-26 15 : 55 : 54.125 : W/System.err (10701) : 원인 : libcore.io.ErrnoException : 열기 실패 : ENOENT (해당 파일 또는 디렉토리 없음) –
wiki