Alert dialog is gone before the user see anything
        Posted  
        
            by 
                Android Developer
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Android Developer
        
        
        
        Published on 2012-11-27T11:02:53Z
        Indexed on 
            2012/11/27
            11:03 UTC
        
        
        Read the original article
        Hit count: 330
        
                PopIt("Exit Application", "Are you sure you want to exit?");
public void PopIt( String title, String message ){
        new AlertDialog.Builder(this)
        .setTitle( title )
        .setMessage( message )
        .setPositiveButton("YES", new OnClickListener() 
        {
            public void onClick(DialogInterface arg0, int arg1) {
                //do stuff onclick of YES
                finish();
            }
        }).setNegativeButton("NO", new OnClickListener() {
            public void onClick(DialogInterface arg0, int arg1) {
                //do stuff onclick of CANCEL
                Toast.makeText(getBaseContext(), "You touched CANCEL", Toast.LENGTH_SHORT).show();
            }
        }).show();
    }
this alert dialog gone so fast as I cant read or click on it !! why is that ?
© Stack Overflow or respective owner