//重启应用                final Intent launchIntent = getApplication().getPackageManager().getLaunchIntentForPackage(getPackageName());                if (launchIntent != null) {                    UIUtils.showToastSafe("应用正在重启中请稍后...");                    new Handler().postDelayed(new Runnable() {                        @Override                        public void run() {                            launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);                            startActivity(launchIntent);                            //添加activity切换动画效果                            overridePendingTransition(0, 0);                            ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);                            am.killBackgroundProcesses("你的包名");                            android.os.Process.killProcess(android.os.Process.myPid());                            System.exit(0);                            finish();                        }                    },400);

更多相关文章

  1. Android屏幕横屏竖屏切换的方法
  2. android 对文件的操作模式
  3. android 第一次运行应用的引导界面
  4. Android打开关闭触摸提示音
  5. Android(安卓)spinner 动态添加时报错 java.lang.UnsupportedOpe
  6. Android开发指南整理
  7. android 利用TrafficStats类获取本应用的流量
  8. 【阿里云镜像】切换阿里巴巴开源镜像站镜像——Fedora镜像
  9. 【阿里云镜像】切换阿里巴巴开源镜像站镜像——Debian镜像

随机推荐

  1. 记录代码合并时产生的bug
  2. Android中一些错误
  3. 常用的android弹出对话框
  4. android之ListView与Adapter(结合JavaBea
  5. android日期控件显示
  6. android webview在弹出软键盘时,布局没有
  7. Android(安卓)md5加密
  8. android 录音 播放
  9. android解析xml的通用写法
  10. Android(安卓)DatePickerDialog存在执行