2017-05-18 1 views
1

onReceivedError을 사용하여 내 웹보기에서 모든 종류의 오류를 감지하지만 해당 웹 사이트가 자국에서 차단 된 경우 검색하고 싶습니다. (net::ERR_CONNECTION_REFUSED 오류). 어떻게해야합니까?webview에서 페이지 로딩 오류를 감지하는 방법은 무엇입니까?

@Override 
    public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { 
     view.loadUrl("about:blank");//hide the error page 
     Toast.makeText(getBaseContext(), "connection lost", Toast.LENGTH_SHORT).show(); 
     findViewById(R.id.welcome).setVisibility(View.VISIBLE); 
     animEnabled = true;//enable welcome screen animation 
     super.onReceivedError(view, errorCode, description, failingUrl); 
    } 

답변

0

onReceived() 콜백의 오류 코드는 필요한 기능을 수행합니다. 특정 유형의 오류 코드에 액세스하기위한 webview 오류 코드를 검토하면됩니다.

관련 문제