안드로이드 개발 질문/답변
(글 수 45,052)
public class SaveFile extends Activity{
public void save() {
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try{
fos = openFileOutput("/data/data/com.test/files/test.dat", Context.MODE_WORLD_READABLE);
System.out.println("파일 세이브 완료");
} catch (Exception e) {
System.out.println("파일 세이브 실패");
System.out.println(e);
} finally {
try{
if(fos != null) fos.close();
if(oos != null) oos.close();
} catch (Exception e) {}
}
}
}
이렇게, 로컬에 저장을 하려고 하는데.. 왜 nullpointerexception 이 뜨는지 모르겠네요..
DDMS 의 파일 익스플로러로 확인해보면 분명 파일은 저장되어 있구요..
SD 카드 말고, 로컬에 저장하고 싶은데 왜 안되는건가요?
adb 에서 shell 을 이용해서 생성되어 있는 파일은 chmod 를 777 로도 해줘봤구요. -_-;




저장 경로를 test.dat 로 해보세요