Android 开发笔记 “弹出框”

AlertDialog.Builder builder = new AlertDialog.Builder(Activity.this); 
builder.setMessage("Are you sure you want to exit?") 
.setCancelable(false) 
.setPositiveButton("Yes", new DialogInterface.OnClickListener() { 
public void onClick(DialogInterface dialog, int id) { 
//     MyActivity.this.finish(); 
} 
}) 
.setNegativeButton("No", new DialogInterface.OnClickListener() { 
public void onClick(DialogInterface dialog, int id) { 
//     dialog.cancel(); 
} 
}); 
AlertDialog alert = builder.create(); 
alert.show();

 

posted @ 2015-02-14 11:40  德玛西亚冲锋  阅读(136)  评论(0编辑  收藏  举报