漫漫Android路,上下而求索!
来源:互联网 发布:大淘客cms文章系统 编辑:程序博客网 时间:2024/04/27 20:47
1.退出Android应用程序:
private void exit(){
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
builder.setTitle("确认退出?");
builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent exitIntent = new Intent(Intent.ACTION_MAIN);
exitIntent.addCategory(Intent.CATEGORY_HOME);
startActivity(exitIntent);
Process.killProcess(Process.myPid());
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.create().show();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_BACK && event.getRepeatCount()==0){
exit();
return false;
}
return super.onKeyDown(keyCode, event);
}
- 漫漫Android路,上下而求索!
- 路漫漫。吾将上下而求索
- 软件工程之路漫漫兮,吾将上下而求索
- 路漫漫其修远,吾将上下而求索!
- 智能家居路漫漫其修远 企业上下而求索
- 路漫漫兮,吾将上下而求索
- [34期] 路漫漫其修遠兮,吾將上下而求索
- 乱漫漫其修远兮,吾将上下而求索
- 程序员之路漫漫兮,吾将上下而求索2008-8-25 12:50阅读(1)
- 程序之路虽漫漫,吾以恒心而求索
- 程序员之路虽漫漫,吾以恒心而求索
- Android嵌入式(初稿)--路漫漫其修远兮,吾将上下而求索
- 吾将上下而求索
- JQuery之路其修远兮,吾将上下而求索
- 算法之路其修远兮,吾将上下而求索
- 路漫漫其修远兮,吾将上下而求索
- 路漫漫其修远兮 吾将上下而求索!
- 路漫漫其修远兮,吾将上下而求索
- forum | futaba
- hdu 2594 Simpsons’ Hidden Talents
- iOS开发之UIDocumentInteractionController
- shape用法
- VMWar 安装Centos 7 (32位) 出现丢失网卡设备的解决方法
- 漫漫Android路,上下而求索!
- SpringMVC中使用Interceptor拦截器
- document.cookie.indexof的解释
- 登录页面
- 如何运行带有pod的项目
- POJ 3415:Common Substrings 后缀数组+单调栈
- Tomcat安装配置
- 关于A/B测试
- 文本挖掘