Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath() + "/customfolder/"
이와 같은 경로에 저장을해서 탐색기로 폴더가 생성되고 jpg 파일 또한생성됬습니다.
long now = System.currentTimeMillis();
Date date = new Date(now);
SimpleDateFormat curDateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_MM_");
String strCurDate = curDateFormat.format(date);
Random random = new Random();
String file_name = strCurDate + String.valueOf(random.nextInt(10000)) + ".jpg";
String string_path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath() + "/customfolder/";
File file_path;
try {
file_path = new File(string_path);
if (!file_path.isDirectory()) {
file_path.mkdirs();
}
FileOutputStream out = new FileOutputStream(string_path + file_name);
image.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.close();
} catch (FileNotFoundException exception) {
Log.e("FileNotFoundException", exception.getMessage());
} catch (IOException exception) {
Log.e("IOException", exception.getMessage());
}
정상적으로 저장됬다고 생각하는데 기본갤러리를 오픈하면 1. 생성되야할 커스텀 폴더가 보이질 않고
Bitmap bitmap = null;
try {
bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imageUri);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return bitmap;
이와 같이 조회해도 2. filenotfoundexception 이 발생합니다. 로그에는 파일이없다고나오네요 .. 답변부탁드립니다