http://www.2cto.com/kf/201403/283563.html
AlertDialog.Builder builder=new Builder(MainActivity.this);
builder.setMessage("确定删除?");
builder.setTitle("提示");
//添加AlertDialog.Builder对象的setPositiveButton()方法
builder.setPositiveButton("确定", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if(listItems.remove(position)!=null){
System.out.println("success");
}else {
System.out.println("failed");
}
simpleAdapter.notifyDataSetChanged();
Toast.makeText(getBaseContext(), "删除列表项", Toast.LENGTH_SHORT).show();
}
时间: 2024-11-03 22:52:08