try so o:
public class WebViewClientImpl extends WebViewClient {
private Activity activity = null;
public WebViewClientImpl(Activity activity) {
this.activity = activity;
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url) {
if(url.indexOf("hotelcolonialdosnobres.com") > -1 )
return false;
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
activity.startActivity(intent);
return true;
}
}
Thus, if the url contains your site, shouldOverrideUrlLoading returns false and returns to the webview call.
dai Voce calls him so:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
WebViewClientImpl webViewClient = new WebViewClientImpl(this);
webView.setWebViewClient(webViewClient);
webView.loadUrl("http://www.hotelcolonialdosnobres.com/");
}
}
Note that to instantiate Webviewclientimpl is passed the same Activity "new Webviewclientimpl(this);" as a parameter.
to learn more about this, visit Jakob Jenkov tutorial which is where I got the reference.
hope it helps!