i am working on a project in which i have to read data from a file and store that data into a string array.
String array position "0" should have first 13 characters of the file, string array position "1" should have next 13 characters of the file. I tried to read only first 13 characters using getchar(), but i was having trouble using it, can anybody point out my error because when i try to run that on the app, the app crashes.
InputStream is = getResources().openRawResource(R.raw.temp);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
try {
while((string = br.readLine()) != null){
string.getChars(0,13, buffer, 0);
String str = new String(buffer);
text.setText(str);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
here, buffer is a char type array.