android studio中AlertDialog的使用

delteacher.setOnClickListener(this);
...........
public void onClick(View v) {
switch
(v.getId()){
case R.id. delete_teacher:
AlertDialog.Builder builder = new AlertDialog.Builder( this);
builder.setTitle( "确定要删除该老师么?");
builder.setIcon(R.drawable. class_delteacher);
builder.setCancelable( false);
builder.setPositiveButton( "删除吧", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.setNegativeButton( "不用了", new DialogInterface.OnClickListener() {
@Override

public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.show();
}}

你可能感兴趣的:(android开发)