Multi Line from Html Document

hello so I am trying to show an update list in a label that has more then one line so i written out this code

    public void GetUpdates() throws Exception {
    URL website = new URL(Configration.UpdatesUrl);
    URLConnection connection = website.openConnection();
    BufferedReader in = new BufferedReader(  new InputStreamReader( connection.getInputStream()));
    StringBuilder response = new StringBuilder();
    String inputLine;
    String info = "";
    int startLine = 1;
    int endLine = 50;
    for (int i = 0; i < startLine; i++) { 
        info = in.readLine(); 
    }
    for (int i = startLine; i < endLine + 1; i++) {
        info = in.readLine();
        System.out.println(info);
    }
    UpdateText.setText(info);
    in.close();
}

But he issue is it only shows the last line now i know you can use html tags but i have the same issue still so basically is just reading the last line of the text here is the document if u want to see it see it

https://www.dropbox.com/s/ids6aa9w0pifdbq/Christian%20Updates.txt?dl=1

Answers


You are updating info with the new value in every loop iteration, instead of appending the new data to info. So the code in the second loop should be like this (note the +=)

for (int i = startLine; i < endLine + 1; i++) {
    info += in.readLine();
    System.out.println(info);
}

You might also want to use StringBuilder for better performance


You're only getting the last line because you are setting the text UpdateText.setText(info); after you have iterated through all of your lines. You should use info += in.readLine(); to get the entire file in one string. Or you could use the string builder that doesnt seem to do anything


Need Your Help

UIScrollView only scrolling vertically

ios7 uiscrollview scroll uiimageview zoom

I am trying to implement scrolling and zooming on my UIImageView but it's only scrolling vertically.

Turning off "Wy-60" in 4GL Informix?

terminal informix telnet 4gl

We have an Informix 4GL forms interface to our database, accessed using a terminal emulator running in WY-60 or "Wyse-60" terminal emulation mode.