January 23rd, 2012, 04:12 PM
|
#4 (permalink)
|
|
Senior Member
Join Date: Jul 2010
Posts: 977
Device(s): Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Thanks: 52
Thanked 199 Times in 144 Posts
|
Code:
public String readFile(BufferedReader br)
{
StringBuilder sb = new StringBuilder();
String tmp;
try
{
while((tmp = br.readLine()) != null)
sb.append(tmp).append("\n");
}
catch(IOException e)
{
Toast.makeText("Failed to read file").show();
return null;
}
return sb.toString();
}
This returns a string containing the text file. All you need to do is set the textview's text to the returned string and you should be good to go.
|
|
|