우선 소스코드 입니다

public class cgtxt extends Activity {
TextView ene;
String filename;
static String path = "/data/data/ps.apk/files/";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cgtxt);
ene = (TextView)findViewById(R.id.ene);
Intent intent = getIntent();
String txt = intent.getStringExtra("TextIn");
filename = txt+".txt";
try{
int a= 0;
FileInputStream txtTK = openFileInput(filename);

byte[] data = new byte[txtTK.available()];

while (txtTK.read(data)!=-1){
a++;
}
Toast.makeText(this, a,0).show();
txtTK.close();

}catch(FileNotFoundException e){
Toast.makeText(this, "File is not found",0).show();
}catch(Exception e)
{
Toast.makeText(this, "Fad",0).show();}
}
}

여기서 보면 (경로설정은 제외) 이 코드 자체의 에러는 없습니다

하지만

byte[] data = new byte[txtTK.available()];

while (txtTK.read(data)!=-1){
a++;
}
여기서

리드 하는동안 와일문으로 a를 증가시키고

그 값을 토스트로 출력시키려고 하면 계속 익셉션으로 캐치되게 됩니다.

왜이럴까요?

하고자 하는것은 원하는 파일에서 한글자씩 가져오고 문자열 배열에 각각 저장하고자 합니다.

이 방법이 제대로 된 방법이 아니라면 방법을 좀 알려주시면 감사하겠습니다