android - Infinite loop in shouldOverrideUrlLoading -


this piece of code creates infinite loop when try display pdf file, how can avoid that?

thanks.

mwebview.setwebviewclient(new webviewclient() {          @override          public boolean shouldoverrideurlloading(webview view, string url) {              string hello = uri.parse(url).gethost();              if (url.endswith(".pdf")){                  system.out.println("pdf: " + url);                  view.loadurl("http://docs.google.com/gview?embedded=true&url=" + url);                  return true;              } else {                 system.out.println("no pdf: " + url);                 view.loadurl(url);               }              return false;             }         }); 

your else should be:

} else {   system.out.println("no pdf: " + url); } 

your loop occur because everytime loadurl-> shouldoverrideurlloading -> loadurl

if don't change url, return false.


Comments

  1. Android - Infinite Loop In Shouldoverrideurlloading - >>>>> Download Now

    >>>>> Download Full

    Android - Infinite Loop In Shouldoverrideurlloading - >>>>> Download LINK

    >>>>> Download Now

    Android - Infinite Loop In Shouldoverrideurlloading - >>>>> Download Full

    >>>>> Download LINK jO

    ReplyDelete

Post a Comment