zoukankan      html  css  js  c++  java
  • Android中退出程序的提示框

    @Override  
    
        public boolean onKeyDown(int keyCode, KeyEvent event) {  
    
            if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {  
    
                dialog();  
    
                return true;  
    
            }  
    
            return true;  
    
        }  
    
    protected void dialog() {  
    
            AlertDialog.Builder builder = new Builder(AccoutList.this);  
    
            builder.setMessage("确定要退出吗?");  
    
            builder.setTitle("提示");  
    
            builder.setPositiveButton("确认",  
    
            new android.content.DialogInterface.OnClickListener() {  
    
                @Override  
    
                public void onClick(DialogInterface dialog, int which) {  
    
                    dialog.dismiss();  
    
                    //AccoutList.this.finish();  
    
                    //System.exit(1);  
    
                    android.os.Process.killProcess(android.os.Process.myPid());  
    
                }  
    
            });  
    
            builder.setNegativeButton("取消",  
    
            new android.content.DialogInterface.OnClickListener() {  
    
                @Override  
    
                public void onClick(DialogInterface dialog, int which) {  
    
                    dialog.dismiss();  
    
                }  
    
            });  
    
            builder.create().show();  
    
        }  
  • 相关阅读:
    PHP设计模式
    秒杀方案
    lua 安装
    docker 相关命令
    dockerfile
    JS工具对象 DATE 方法
    JS工具对象 Array
    JS工具对象 String 10种常用 方法
    工具对象
    JS工具对象Math 7个常用 方法
  • 原文地址:https://www.cnblogs.com/greywolf/p/2828343.html
Copyright © 2011-2022 走看看