I am using a webview of height 60dp and i am passing a local html file to it, by default when i click a link in the webview it has to open the browser . But strangely its opens the links with in the webview, i also tried the webview client and trying to pass the response url to default browser through intent, but in vain..
my code snippet:
WebViewClient yourWebClient = new WebViewClient()
{
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
System.out.println("Inside WebViewClient the URL is....."+url);
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
return true;
}
};
WebView ad = (WebView) findViewById(R.id.webview1);
ad.getSettings().setJavaScriptEnabled(true);
ad.loadUrl(feed.getItem(position).getLink());
ad.getSettings().setLoadWithOverviewMode(true);
ad.getSettings().setUseWideViewPort(true);
ad.setInitialScale(100);
ad.setWebViewClient(yourWebClient);
ad.loadUrl("file:///android_asset/advertisement.htm");