안드로이드 개발 질문/답변
(글 수 45,052)
File sdRoot = Environment.getExternalStorageDirectory();
String appName = StringUtil.getString(context, R.string.app_name);
File expFile = new File(sdRoot.getPath()+File.separator+appName+"_"+model.getuDate().replaceAll(" ", "_")+".txt");
if( !expFile.exists() && expFile.createNewFile() )
{
FileOutputStream fOut = new FileOutputStream(expFile);
fOut.write(model.getMessage().getBytes());
fOut.flush();
fOut.close();
}
제가 String 문자열들을 sd카드에 저장하고 싶거든요..
getuDate 는 업데이트된 시간이구요.
이런 식으로 저장을 하려고 하는데
계속 IOException 이 if 구문에 계속 걸리네요..
Invalid argument 라고 계속 뜨고 createNewFile 도 같이 뜨는데
이유가 뭔가요..
고수분들 알려주시면 감사하겠습니다 ㅠㅠ




파일이 존재하는지 묻고 -> 존재하면 열고 쓴다 -> 존재하지 않으면 만들고 열어서 쓴다 -> 마지막에는 닫는다.... 정도가 되게네요