1 AlertDialog dialog = new AlertDialog.Builder(this).create(); 2 dialog.setTitle("对话框"); 3 dialog.setIcon(R.drawable.i ...
1 AlertDialog dialog = new AlertDialog.Builder(this).create(); 2 dialog.setTitle("对话框"); 3 dialog.setIcon(R.drawable.ic_launcher); 4 dialog.setButton(DialogInterface.BUTTON_POSITIVE, "确认", new DialogInterface.OnClickListener() { 5 6 @Override 7 public void onClick(DialogInterface dialog, int which) { 8 String s = data.get(pos); 9 10 data.remove(pos);11 data.add(0, s);12 13 mAdapter.notifyDataSetChanged();14 15 Toast.makeText(getApplicationContext(), "已确认!", 0).show();16 }17 });18 19 dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "取消", new DialogInterface.OnClickListener() {20 21 @Override22 public void onClick(DialogInterface dialog, int which) {23 String s = data.get(pos);24 25 Toast.makeText(getApplicationContext(), "已取消!", 0).show();26 }27 });28 dialog.show();
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:点击事件的确认取消对话框。
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。