0
외부 SD 카드에 jpg 이미지를 쓰려고합니다. 그러나, 나는 System.err FileNotFoundException: /mnt/sdcard/test.images/temp/savedImage (no such file or directory)
을 얻고있다. 디렉토리 생성도 실패하고 LogCat에서 false
을 제공하며 내 SD 카드를 볼 때 폴더를 볼 수 없습니다. 다음과 같이외부 SD에 기록하려는 안드로이드 오류
내 코드는 다음과 같습니다
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
File folder = new File(Environment.getExternalStorageDirectory() + "/test.images/temp");
try {
if(!folder.exists()){
boolean dir = new File(Environment.getExternalStorageDirectory() + "/test.images/temp").mkdir();
Log.v("creating directory", Boolean.toString(dir));
}
File imageOutputFile = new File(Environment.getExternalStorageDirectory() + "/test.images/temp", "savedImage");
FileOutputStream fos = new FileOutputStream(imageOutputFile);
Image.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
내가 매니페스트에 허가 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
을 가지고 청소하고 재건했다.
'파일 imageOutputFile = 새로운 파일 (Environment.getExternalStorageDirectory() + "/test.images/temp/", "savedImage.jpg");' –
가에서 mkdir * s의의 *() –
작품, 감사 귀도와 함께하려고합니다. –