How can I know that my WebView is loaded 100%?

I'm trying to load in my WebView some HTML code that contains JavaScript.

Now , I want to test if my WebView is loaded before 5 secondes. I've tried the method getProgress(), but sometimes I get that the progress is 100, but my Webview is not loaded.
Is there another way to be sure that my Webview is loaded 100%?

This is a part of my code :

sdk.getWebView().loadDataWithBaseURL("notreal/", data_html,MIME_TYPE,ENCODING_UTF_8,null);

Timer timer = new Timer();
TimerTask task = new TimerTask() {

    @Override
    public void run(){                      
    Log.i("TAG", "progress fin = "+sdk.getWebView().getProgress());

    if(sdk.getWebView().getProgress() <100){
        //cancel the webView
        sdk.getContext().runOnUiThread(new Runnable() {
             @Override
             public void run() {
            sdk.getImgView().setVisibility(View.VISIBLE);
            sdk.getWebView().setVisibility(View.GONE);
             }
        });
    }

    // else ,the Webview is loaded
    else{
        //prepare webview 
        sdk.getContext().runOnUiThread(new Runnable() {
            @Override
            public void run(){
                     // hide imageView
                     sdk.getImgView().setVisibility(View.GONE);
                     sdk.getWebView().setVisibility(View.VISIBLE);
            }
        });
    }

 }
 };
 timer.schedule(task, 5000);

As said here: How to listen for a WebView finishing loading a URL?

boolean loadingFinished = true;
boolean redirect = false;

mWebView.setWebViewClient(new WebViewClient() {

   @Override
   public boolean shouldOverrideUrlLoading(WebView view, String urlNewString) {
       if (!loadingFinished) {
          redirect = true;
       }

   loadingFinished = false;
   view.loadUrl(urlNewString);
   return true;
   }

   @Override
   public void onPageStarted(WebView view, String url, Bitmap facIcon) {
        loadingFinished = false;
        //SHOW LOADING IF IT ISNT ALREADY VISIBLE  
    }

   @Override
   public void onPageFinished(WebView view, String url) {
       if(!redirect){
          loadingFinished = true;
       }

       if(loadingFinished && !redirect){
         //HIDE LOADING IT HAS FINISHED
       } else{
          redirect = false; 
       }

    }
});

The best way to detect if a page has rendered is to use the onPageCommitVisible callback, available from API 23. onPageLoadFinished is not suitable, since it's delivered too soon (when the HTML is processed, but not yet rendered).

webview.setWebViewClient(new WebViewClient() {

    @Override
     public void onPageCommitVisible (WebView view, 
            String url)
    }
}

webView.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                if (progress == 100) {
                    //do your task

                }
            }
        });