My code opens a txt file from the net and places it in a textview. The problem is that it joins all the lines. How do I break the lines?
Another question is how to delete the tags from the text file and not break the rtmp and rtmpe links. since with http there is no problem converting to link
package com.tvmix.read;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class ReadFileAssetsActivity extends Activity {
TextView textMsg;
final String textSource = "https://dl.dropboxusercontent.com/s/w7ga6shmocr23x4/Eventos.txt?dl=0";
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textMsg = (TextView) findViewById(R.id.textmsg);
URL textUrl;
try {
textUrl = new URL(textSource);
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream()));
String StringBuffer;
String stringText = "";
while ((StringBuffer = bufferReader.readLine()) != null) {
stringText += StringBuffer;
}
bufferReader.close();
textMsg.setText(stringText);
} catch (MalformedURLException e) {
e.printStackTrace();
textMsg.setText(e.toString());
} catch (IOException e) {
e.printStackTrace();
textMsg.setText(e.toString());
}
}