Issue
I am preparing sample app based on Web View. In my Splash screen have to load on url,if i click on splash screen it will open another site.It is working fine.But when i click on splash screen i want open separate browser.For that i have used following code,
this.webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
return true;
}
});
But it is opening same browser.Please Guide me.
Solution
view.loadUrl(url)
will open the url in the same WebView. You have to define rule when to load in the same WebView or another seperate WebView or Browser. To load in seperate webview call anotherWebView.loadUrl(url)
. Or browser call with Intent.ACTION_VIEW
.
The workaround could be like this-
if(need to load same webView)
{
view.loadUrl(url);
}
else if(need to load same webView)
{
anotherWebView.loadUrl(url);
}
else
{
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
Answered By - Shaiful
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.