There is a button open in the browser. But I made a restriction on some restrictions so that local files could not be opened. But after clicking the application tries to run them. Where is my mistake?

if (mWebView.getUrl() == "file:///android_asset/moreinfoapp.html"){ Toast toast = Toast.makeText(getApplicationContext(), R.string.err_obrow_1, Toast.LENGTH_SHORT); } else if (mWebView.getUrl() == "file:///android_asset/errnoconnect.html"){ Toast toast = Toast.makeText(getApplicationContext(), R.string.err_obrow_1, Toast.LENGTH_SHORT); } else { Intent browseIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mWebView.getUrl())); startActivity(browseIntent); } 

1 answer 1

 String urlbrowser = mWebView.getUrl(); if(urlbrowser.equals("file:///android_asset/moreinfoapp.html")){ Toast.makeText(getApplicationContext(), R.string.err_obrow_1,Toast.LENGTH_LONG).show(); }else if (urlbrowser.equals("file:///android_asset/errnoconnect.html")){ Toast.makeText(getApplicationContext(), R.string.err_obrow_1,Toast.LENGTH_LONG).show(); }else{ Intent browseIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mWebView.getUrl())); startActivity(browseIntent); } 

Wrong Compared. Read more