取消确认订单(取消确认)
大家好,小东方来为大家解答以上的问题。取消确认订单,取消确认这个很多人还不知道,现在让我们一起来看看吧!
1、public class BackKeyTest extends Activity{/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.main);}@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event){if (keyCode == KeyEvent.KEYCODE_BACK ){// 创建退出对话框AlertDialog isExit = new AlertDialog.Builder(this).create();// 设置对话框标题isExit.setTitle("系统提示");// 设置对话框消息isExit.setMessage("确定要退出吗");// 添加选择按钮并注册监听isExit.setButton("确定", listener);isExit.setButton2("取消", listener);// 显示对话框***.show();}return false;}/**监听对话框里面的button点击事件*/DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener(){public void onClick(DialogInterface dialog, int which){switch (which){case AlertDialog.BUTTON_POSITIVE:// "确认"按钮退出程序finish();break;case AlertDialog.BUTTON_NEGATIVE:// "取消"第二个按钮取消对话框break;default:break;}}};}。
本文到此分享完毕,希望对大家有所帮助。
免责声明:本文由用户上传,如有侵权请联系删除!
猜你喜欢
- 12-26
- 12-26
- 12-26
- 12-26
- 12-26
- 12-26
- 12-26
- 12-26
最新文章
- 12-26
- 12-26
- 12-26
- 12-26
- 12-26
- 12-26
- 12-26
- 12-26