public void saveByteArrayToFile(Context context){
Log.v(TAG, "Save byte array to file");
switch(mType){
case ChatMessage.AUDIO_MESSAGE:
filePath = context.getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_MUSIC).getAbsolutePath()+"/"+fileName;
break;
case ChatMessage.VIDEO_MESSAGE:
filePath = context.getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_MOVIES).getAbsolutePath()+"/"+fileName;
break;
case ChatMessage.FILE_MESSAGE:
filePath = context.getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()+"/"+fileName;
break;
case ChatMessage.DRAWING_MESSAGE:
filePath = context.getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath()+"/"+fileName;
break;
}
System.out.println("Mera path"+filePath);
File file = new File(filePath);
if (file.exists()) {
file.delete();
}
try {
FileOutputStream fos=new FileOutputStream(file.getPath());
fos.write(byteArray);
fos.close();
Log.v(TAG, "Write byte array to file DONE !");
}
catch (java.io.IOException e) {
e.printStackTrace();
Log.e(TAG, "Write byte array to file FAILED !");
}
}
java.io.FileNotFoundException :/저장/sdcard0/안드로이드/데이터/... 에 의해 발생 : android.system.ErrnoException : 실패 열지 : ENOENT (없음 같은 파일 또는 디렉토리)오류가
파일을 만드는 중에이 오류가 발생합니다.
에 설명 된대로, SDK 버전을 대상으로하는 경우 그 길에 쓴다 고요? – LEQADA