zoukankan      html  css  js  c++  java
  • Android AlertDialog 实例

    public boolean onKeyDown(int keyCode, KeyEvent event)
        {
            if(keyCode == KeyEvent.KEYCODE_BACK)
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(cxt);
                alert.setTitle("退出提示");
                alert.setMessage("确认退出吗?");
                alert.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub
                        
                    }
                });
                alert.setPositiveButton("确认", new DialogInterface.OnClickListener() {
                    
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        System.exit(0);                    
                    }
                });
                alert.show();
            }
            return false;
        }
    xtc在类里面定义private Context cxt = null;
  • 相关阅读:
    受益一生的15个学习习惯
    如何在工作的头三年里让自己变得强大
    linux定时执行脚本
    SpringMVC基础入门
    Spring与Quartz的整合实现定时任务调度[转]
    强肝保肝养肝4大食物
    Spring官网jar包下载方法
    tomcat管理端的页面安全措施
    Struts2 Action 动态传参数
    Java之控制反转和依赖注入
  • 原文地址:https://www.cnblogs.com/whtydn/p/2501404.html
Copyright © 2011-2022 走看看