안드로이드 개발 질문/답변
(글 수 45,052)
try{
FileInputStream fis =openFileInput("record.txt");
byte[] data = new byte[fis.available()];
while(fis.read(data) != -1){;}
fis.close();
a.setText(new String(data));
}catch(FileNotFoundException fnfe){
a.setText("file not found");
}catch(Exception e){;}
}
}
저 텍스트 파일에 저장된 데이터를 불러올때 라인단위로 끊어서
제가 원하는 라인까지만 출력할 수 는 없을까요?
LineNumberReader를 사용 할려고하면 ..예외처리가 뜨네요 ㅠㅠ
고수님들의 답변 기다리고있겠습니다!




대충 간단하게
BufferedReader br = new BufferedReader(new FileReader(new File("record.txt")));
String line = null;
while((line = reader.readLine()) != null) {
line.toString()
}
이대로 사용하진 마시고 보시고 검색해보세요.