No código abaixo, link com mcpack são a abertos no WebView do aplicativo, porém, às vezes, ele abre no navegador padrão, o que eu faço?
@Override
public boolean shouldOverrideUrlLoading(WebView view, final String url)
{
if (url.contains("https://www.mediafire.com/file/") || (url.endsWith("mcpack") || (url.contains("https://www.mediafire.com/download_repair.php") || (url.contains("http://engine.addroplet.com/")) ))) { // Could be cleverer and use a regex
mWebView.loadUrl(url);
return false;
}
mWebView.stopLoading();
mWebView.goBack();
final AlertDialog alertDialog = new AlertDialog.Builder(Textures.this).create();
alertDialog.setTitle("Navegador");
alertDialog.setMessage("Deseja abrir o navegador?");
alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "Sim", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
}
});
alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Não", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog.dismiss();
}
});
alertDialog.show();
return false;
}