The urls are just text files like www.example.com/example.txt so what I need to do is get the whole text from the website. The text can be very long up to 1MB. I dont know how I should modify my code to do this.
Here is my code
private class Title extends AsyncTask<Void, Void, Void> {
String text;
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(Story.this);
progressDialog.setMessage("Loading");
progressDialog.setIndeterminate(false);
progressDialog.setCancelable(false);
progressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
try {
Document document = Jsoup.connect(url).get();
text = document.text(); //I made this part up. Definitely WRONG
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
story.add(text); //story is an array
progressDialog.dismiss();
}
}
I call it with new Title().execute();
This code doesn't work I cant get the text. Nothing happens.