Try this way:
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;
}
}
That way, if the url contains your site, shouldOverrideUrlLoading returns false and returns to the webview call.
So you call him like this:
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 the WebViewClientImpl is passed to the same " new WebViewClientImpl (this); " activity as parameter.
To learn more about this, visit Jakob Jenkov tutorial that was where I took the reference.
I hope it helps!