0
텍스트 파일의 모든 문자를 읽고 싶습니다. 예를 들어, 다음 텍스트 "John 26 Canada"가 포함 된 텍스트 파일이 있고 각 문자를 특정 텍스트보기에 넣을 수 있도록 모든 문자를 읽으 려합니다. 이것은 결과물입니다.Android - 텍스트 파일의 문자 읽기
이름 : 존 나이 : 26 국가 : 캐나다
내가 텍스트 파일에 데이터를 저장에서이 코드가 있습니다.
private void performSaveFile(String f) {
// this does the actual file saving.
// set the filename in the interface:
EditText name = (EditText) findViewById(R.id.etName);
EditText age = (EditText) findViewById(R.id.etAge);
EditText country = (EditText) findViewById(R.id.etCountry);
String strFileContent = name.getText().toString()
+ age.getText().toString() + country.getText().toString();
// ... and save the file:
try {
FileOutputStream oStream = openFileOutput(f, Context.MODE_PRIVATE);
oStream.write(strFileContent.getBytes());
oStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
당신이 가지고있는 문제는 무엇인가 ... 지금 당신이 name.Code이 이렇게되면 파일이어야 문자열로 f를 촬영 한 코드이다? –