안녕하세요.
아래와 같이 Internal storage에 txt파일을 쓰고,
InputStream input = new BufferedInputStream(url.openStream());
FileOutputStream output = openFileOutput( "filename.txt" , Context.MODE_PRIVATE);
byte data[] = new byte [ 1024 ];
long total = 0 ;
while ((count = input.read(data)) != - 1 ) {
total += count;
output.write(data, 0 , count);
}
output.flush();
output.close();
input.close();
|
아래와 같이 읽어오고 있습니다.
InputStream myFile = openFileInput( "filename.txt" );
StringBuffer strBuffer = new StringBuffer();
String str = null ;
BufferedReader in = new BufferedReader( new InputStreamReader(myFile, "utf-8" ));
while ((str = in.readLine()) != null ) {
strBuffer.append(str + "\n" );
}
in.close();
TextView tt = (TextView) findViewById(R.id.text);
tt.setText(strBuffer);
|
이렇게 하면 영어는 괜찮게 나오는데 한글은 무조건 깨져서 나옵니다
며칠째 구글링을 해봤지만 제자리 걸음입니다.
고수분들의 도움 구합니다.. ㅜㅜ
도와주세요...
감사합니다.