I am using an httpclient to display a web page in the webView using loadDataWithBaseURL. My web site has some links and I want to continue using httpClient when user clicks on the link. Is it possible to do? In this case when user clicks on the link i must intercept the link, so that my browser will load it, then stop loading it and use HttpGet. Does it sound reasonable enough?
EDIT: Yup, that was a good idea.. firstly you set a client
comments.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
String LinkTag = "";
try {
LinkTag = client.httpGet(url);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
comments.loadDataWithBaseURL("BaseWebUrl", LinkTag, "text/html", "utf-8", "");
return true;
}
});
And secondly you must create an httpClient to handle your Posts and Gets and maybe other methods as well