multithreading - Android: splash screen and webview -


i've trying days solution show splash screen while loading webview.

i've looked around , there several approaches: - make activity show splash screen, wait few seconds , start webview activity -> not solution since loading again done after splash screen closed

  • second approach this:

       mywebview = (webview) findviewbyid(r.id.webview); mywebview.getsettings().setjavascriptenabled(true); mywebview.setscrollbarstyle(webview.scrollbars_outside_overlay);  mywebview.setwebviewclient(new webviewclient() {    public void onpagefinished(webview view, string url) {        findviewbyid(r.id.webview).setvisibility(view.visible);         //hide loading image        findviewbyid(r.id.imageview1).setvisibility(view.gone);        //show webview       }     }); 

    this works, again there slight appearance of white screen while transitioning webview. , can't control timing of splash screen.

  • third solution i'd make, (even after few days of searching , trying) don't know how -> show splash screen in 1 thread, prepare webview in , switch webview.

my question is, can show me start third solution?

  • i wanted try this! couldn't figure out how pass webview activity , read, not idea.

any suggestion, ideas, pointers? there way show splash screen, prepare(inflate) webview in thread , switch after loading url (and else) done?

thanks!!!

try use webchromeclient on webview. in webchromeclient, have method onprogresschange.

you can disappear splash screen when onprogresschange tell page finish load.

edit: can call in thread url httpget example , retrieve response. when have response can load webview loaddata(...) method.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -