Issue
I want to get html tags.For ex www.google.com. When I enter this site with in android webview. How I get this? But how I get html from webview?
Solution
You can use
URI uri = URI.create("http://whatever.com/thingie");
HttpPost post = new HttpPost(uri);
StringEntity ent = new StringEntity("Here is my data!");
post.setEntity(ent);
HttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(request);
InputStream stream = response.getEntity().getContent();
More information : Link
Then you can convert content of response to String using
private String inputStreamToString(InputStream is) {
String s = "";
String line = "";
// Wrap a BufferedReader around the InputStream
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
// Read response until the end
while ((line = rd.readLine()) != null) { s += line; }
// Return full string
return s;
}
Answered By - Behnam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.