android - WebView must be loaded twice to load correctly -


when page webview first loads, images missing or displayed incorrectly. if reload page webview displays perfectly. know first think set javascript after loadurl, isn't true.

in oncreate have:

learnwebview = (webview)findviewbyid(r.id.learnwebview); learnwebview.setwebviewclient(new webviewclient()); learnwebview.getsettings().setjavascriptenabled(true); 

then later in function called after oncreate have:

learnwebview.loadurl("myurl"); 

and yes, know function loadurl called after oncreate every time.

please try instead of way, bad practice:

        learnwebview.post(new runnable() {              @override             public void run() {                 learnwebview.loadurl("myurl");             }         }); 

or this, in case first 1 wont work:

        learnwebview.postdelayed(new runnable() {              @override             public void run() {                 learnwebview.loadurl("myurl");             }         }, 500); 

hope helps.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -