I would like dialog to close after 10 seconds. I can only do this by clicking the button.
Follow the code.
AlertDialog.Builder alert = new AlertDialog.Builder(this);
WebView wv = new WebView (this);
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
wv.loadUrl("http://192.168.200.233:8888/Propagandas/Propagandas.html");
wv.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
view.loadUrl(request.getUrl().toString());
return true;
}
});
alert.setView(wv);
alert.setNegativeButton("Fechar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
alert.show();
Handler handler = new Handler();
handler.postDelayed( this, 2000 );
Is it possible?