So i'm trying to redirect from a webview to another activity after X seconds. The problem is that the new activity is launched two times for some reason..
any solutions? Sample code below.
myWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url){
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
Intent intent = new Intent(myContext, RegistrerActivity.class);
startActivity(intent);
timer.cancel();
}
}, 5000);
return false;
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
//Code for response
}