views:

65

answers:

1

Hello, In my app is the ability to read a file. This works perfectly, but there's a problem. No line breaks or whatever they are called get added when I append the file's contents to my big EditText, so this:

function hmm(){
 echo 'Hello, PHP!';
}

would turn into this:

function hmm(){ echo 'Hello, PHP!'; }

How can I stop this and make it appear in the EditText as it appears in the file?

Thanks for reading, Alex.

UPDATE: REALLY sorry for wasting your time, I went stupid and didn't think about adding "\n" after the while loop has appended each line.

A: 

Problem solved.

Basically in the while loop that's used to output each line you need to append a line break (\n) like so:

     while (dis.available() != 0) {
      textBox.append(dis.readLine() + "\n");
     }

With textBox being an Android EditText.

This will make the EditText look exactly as the text does in the file you selected.

AlexPriceAP