I am try to parse a txt file from a url to a textview in my application the text is being display but the text are not display in the right format as it is online like spaces, next line, paragraph e.t.c. simply put what i want is>
CHAPTER 1
INTRODUCTION TO MOBILE
Majority of the population use mobile services.
Mobile is a term used via a mobile device such as a mobile phone.
but I am getting
CHAPTER 1 INTRODUCTION TO MOBILE Majority of the population use mobile services.Mobile is a term used via a mobile device such as a mobile phone.<< no space, no paragraph, no next line, how can i parse it to display exactly the way it is online.Thanks
public class GetNotePadFileFromServer extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
try {
url = new URL(TextFileURL);
bufferReader = new BufferedReader(new InputStreamReader(url.openStream()));
while ((TextHolder2 = bufferReader.readLine()) != null) {
TextHolder += TextHolder2;
}
bufferReader.close();
} catch (MalformedURLException malformedURLException) {
malformedURLException.printStackTrace();
TextHolder = malformedURLException.toString();
} catch (IOException iOException) {
iOException.printStackTrace();
TextHolder = iOException.toString();
}
return null;
}
@Override
protected void onPostExecute(Void finalTextHolder) {
textView.setText(TextHolder);
super.onPostExecute(finalTextHolder);
}
}