title: delay an alertdialog
body: <p>is it posible ??
  I have an activity and an alertdialog on it.
  but i need the activity run first and then 2 seconds later appears the alertdialog.
  i have no idea how. regards</p>
  
  <p>pd: iam not an english speaker</p>
  
  <pre><code>public class Pantalladeinicio extends Activity {
  
  private final int SPLASH_DISPLAY_LENGTH = 2000; 
  
   @Override
   public void onCreate(Bundle savedInstanceState) {
  
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
      WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.index);
  
  
    if(checkInternetConnection()==true) {
  
    new Handler().postDelayed(new Runnable() {
  
     public void run() {
      Intent mainIntent = new Intent(Pantalladeinicio.this,
        NetworkingActivity.class);
      mainIntent.putExtra("MAIN", true);
      startActivity(mainIntent);
      finish();
     }
    }, SPLASH_DISPLAY_LENGTH); 
  
    } 
  
    else
    {
           AlertDialog.Builder dialogo1 = new AlertDialog.Builder(this);  
              dialogo1.setTitle("Importante");  
              dialogo1.setMessage("Debe activar la Conexion a Internet");            
              dialogo1.setCancelable(false);  
              dialogo1.setPositiveButton("Aceptar", new  DialogInterface.OnClickListener() { 
  
  
                  public void onClick(DialogInterface dialogo1, int id) {  
  
                      aceptar();  
                  }  
              }); 
              dialogo1.show();
        Log.v("TAG", "Internet Connection Not Present");
  
  
    }
  
  
  
  
  
  
   }
  
  
   public void aceptar() {
         // Toast t=Toast.makeText(this,"Bienvenido a probar el programa.", Toast.LENGTH_SHORT);
  
       super.onDestroy();
        finish();
  
      }
  
  
  
   private boolean checkInternetConnection() {
          ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
          // test for connection
          if (cm.getActiveNetworkInfo() != null
                  &amp;&amp; cm.getActiveNetworkInfo().isAvailable()
                  &amp;&amp; cm.getActiveNetworkInfo().isConnected()) {
              return true;
          } else {
              //Log.v("TAG", "Internet Connection Not Present");
  
              return false;
          }
      }
  </code></pre>
  
  <p>}</p>