How do i read a text file from internal storage and display it in a textview?
So this is the situation, on a second activity i have two edittext saving the input data to two separate files. I want to retrieve those files and display the separate content in separate textviews.
public void refreshHandler(View view)
{
TextView textView7 = (TextView) findViewById(R.id.textView7);
TextView textView8 = (TextView) findViewById(R.id.textView8);
String myData = "";
try {
File myInternalFile = (Names.txt);
FileInputStream fis = new FileInputStream(myInternalFile);
DataInputStream in = new DataInputStream(fis);
BufferedReader br = new BufferedReader(new
InputStreamReader(in));
String strLine;
while ((strLine = br.readLine()) != null) {
myData = myData + strLine;
}
in.close();
}
catch (IOException e) { e.printStackTrace();
}
textView7.setText(myData);
textView8.setText(myData);
}