I am writing simple Android application which parse html at specific positions, take some data and show in a ListView
. As app need only plain html response is there any possibility to request only plain html. How to exclude css and java script files, images and similar from http request?
I am using apache HttpClient
object.
Asked
Active
Viewed 695 times
0

Raynold
- 443
- 2
- 9
- 28

Nikola Jovic
- 2,329
- 2
- 16
- 17
1 Answers
1
Does this answer your question? If so, remember to perform this on a separate thread to avoid UI blocking (probably want to use AsyncTask)
(From How to get the html-source of a page from a html link in android?)
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);
String html = "";
InputStream in = response.getEntity().getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuilder str = new StringBuilder();
String line = null;
while((line = reader.readLine()) != null)
{
str.append(line);
}
in.close();
html = str.toString();
-
Thanks for answer. I already have implemented that (similar code). But I am wondering does it takes only plain html response or everything (images, css files, java script files and similar) for that particular http request. If yes, how can I explicitly disable everything except plain html response... – Nikola Jovic Mar 22 '13 at 05:54