WebViewClient onReceivedError IF()不起作用

时间:2018-02-11 21:05:45

标签: java

我有这个代码,它不起作用:

if (desctiption == "net :: ERR_INVALID_ARGUMENT" ") 

相反,如果我写

if (desctiption! =" Net :: ERR_INVALID_ARGUMENT "") 

我创建了Toast对象,文本等于

net: : ERR_INVALID_ARGUMENT

代码:

webView.setWebViewClient(new WebViewClient() {


        @Override
        public void onReceivedError(WebView view, int errorCode,
                                    String description, String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);


            Toast toast = Toast.makeText(getBaseContext(),description, Toast.LENGTH_LONG);

            if (description == "net::ERR_INVALID_ARGUMENT"){
            toast.show();}



        }


    });
}

0 个答案:

没有答案