I am trying to read all the text from server, I think that my code is not retrieving text from server will you please help me how can I fix this problem, I am new to android dev
May be you can try like this, just a thought only :
StringBuilder content = new StringBuilder();
// read text returned by server
BufferedReader in = new BufferedReader(new InputStreamReader(new URL("http://www.google.com:80/").openConnection().getInputStream()));
String line;
while ((line = in.readLine()) != null) {
content.append(line +"\n");
}
tv.setText(content.toString());
setContentView(tv);
Take these lines
tv.setText(line);
setContentView(tv);
out of while loop
Use StringBuilder object (declared before loop) in while loop and append the strings in that. After while loop take string from StringBuilder and do tv.setText(string)