SteveEdson
SteveEdson

Reputation: 2495

Android: Where to dismiss my splash screen

My app loads up a json feed and a webview, the url of the webview is taken from the webview. I cannot show anything until both of these are loaded, therefore I am using a splash screen. My problem is that my webview connects to a socket.io server using XHR-Long Polling. Therefore, my webview thinks that it is still loading data, and never fires the onPageFinished event, which is where I was previously dismissing my dialog, before I added socket.io. This means that the splash screen never dismisses.

Where can I put my .dismiss() so that it only dismisses once everything is loaded? Is there anything I can do to make the webview think it has loaded the page? My question is basically, what is the best way to handle this?

Thanks

Upvotes: 0

Views: 270

Answers (1)

Patrick Decat
Patrick Decat

Reputation: 630

you can bind your Android dismiss() to the WebView's Javascript interface, then call it from Javascript code running in the WebView (e.g. in your XHR callback).

Check this out : http://developer.android.com/guide/webapps/webview.html#UsingJavaScript

Regards, Patrick.

Upvotes: 1

Related Questions