AlertDialog.Builder builder = new Builder(MainActivity.this);
builder.setTitle("删除?");
final EditText et = new EditText(MainActivity.this);
builder.setView(et);
builder.setPositiveButton("修改", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
修改逻辑
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//对话框删除
dialog.dismiss();
}
});
String name = et.getText().toString();
if (name != null && !"".endsWith(name)){
//修改本地数据
upda(name,shopList.get(position));
//修改shopList里面的对应数据
shopList.get(position).setName(name);
//刷新
shopAdapter.notifyDataSetChanged();
}
private void upDateLocalData(String name,Shop shop){
ContentValues values = new ContentValues();
values.put("shopName", name);
db.update("shopinfo", values, "shopName = ?", new String[]{shop.getName()});
}
手机扫一扫
移动阅读更方便
你可能感兴趣的文章