I’ve got an app, that has 2 activity, the first one launch the second to load a url into a webview.
It works, but while the url is loading , the webview appear empty… then i want to make a splash screen or something like this, to show it while the url is loading, I did that in a new activity, but i don’t know what can i do to close the third activity when the url is loaded… Please can anybody help me?
This is my code…Thank you!
public class Visor extends Activity {
WebView mWebView;
int Result;
@Override
public void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.visor);
Bundle extras=getIntent().getExtras();
String s= extras.getString("url");
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginsEnabled(true);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.loadUrl(s);
mWebView.setWebViewClient(new VisorClient());
mWebView.getSettings().setBuiltInZoomControls(true);
}
private class VisorClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
lanzarIntro();
}
@Override
public void onPageFinished(WebView view, String url) {
mWebView.loadUrl(url);
}
}
public void lanzarIntro(){
Intent i=new Intent (this, Intro.class);
startActivity(i);
}
}
I do it by initially showing an ImageView and then once the WebView has loaded, swapping their visibility like this
And my xml layout looks like this