private void dialog1(){
AlertDialog.Builder builder=new AlertDialog.Builder(this); //先得到构造器
builder.setTitle("提示"); //设置标题
builder.setMessage("是否确认退出?"); //设置内容
builder.setIcon(R.mipmap.ic_launcher);//设置图标,图片id即可
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() { //设置确定按钮
@Override
public void onClick(DialogInterface dialog, int which) {
//实现点击删除
mRecycleAdapter.notifyItemRemoved(1);
//关闭dialog
dialog.dismiss();
Toast.makeText(MainActivity.this, "确认" , Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { //设置取消按钮
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Toast.makeText(MainActivity.this, "取消" , Toast.LENGTH_SHORT).show();
}
});
//参数都设置完成了,创建并显示出来
builder.create().show();
}
AlertDialog.Builder builder=new AlertDialog.Builder(this); //先得到构造器
builder.setTitle("提示"); //设置标题
builder.setMessage("是否确认退出?"); //设置内容
builder.setIcon(R.mipmap.ic_launcher);//设置图标,图片id即可
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() { //设置确定按钮
@Override
public void onClick(DialogInterface dialog, int which) {
//实现点击删除
mRecycleAdapter.notifyItemRemoved(1);
//关闭dialog
dialog.dismiss();
Toast.makeText(MainActivity.this, "确认" , Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { //设置取消按钮
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
Toast.makeText(MainActivity.this, "取消" , Toast.LENGTH_SHORT).show();
}
});
//参数都设置完成了,创建并显示出来
builder.create().show();
}