Android 在程序中重启APP的方法
来源:互联网 发布:网络舆论的影响答案 编辑:程序博客网 时间:2024/05/29 16:14
1. 方法一 利用PackageManager类
Intent i = getBaseContext().getPackageManager() .getLaunchIntentForPackage( getBaseContext().getPackageName() );i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);startActivity(i);
2. 方法二 利用PendingIntent
Intent mStartActivity = new Intent(context, StartActivity.class);int mPendingIntentId = 123456;PendingIntent mPendingIntent = PendingIntent.getActivity(context, mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);AlarmManager mgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);System.exit(0);
1 0
- Android 在程序中重启APP的方法
- Android 在进程中重启app的方法
- android在一个app程序中,打开另一个app的方法
- android在一个app程序中,打开另一个app的方法
- android模拟器上安装和卸载app程序的方法
- 在Android命令行启动程序的方法
- 在Android命令行启动程序的方法
- 在Android Studio中 修改APP包名的方法
- Android中外部程序activity调用本地程序的app方法。
- android的HAL第二种调用hal方法中的APP 测试程序(属于APP层)代码的实现:
- 如何在自己的App中调用Android系统自带的安装/卸载程序
- android模拟器上最简单的安装和卸载app程序的方法
- android模拟器上最简单的安装和卸载app程序的方法
- 在android模拟器上安装apk程序的方法
- Android 程序在锁屏下仍然工作的方法
- 关于Android退出程序的问题(在主页面或任意页面退出App)
- Android中通过外部程序启动App的三种方法
- Android中通过外部程序启动App的三种方法
- JPA学习笔记(12)——JPQL
- Linux 调试 core dump文件
- Apache Http Server与Tomcat实现负载均衡和集群
- sql2012DAC连接
- dilate函数
- Android 在程序中重启APP的方法
- Popupwindow实现透明
- kafka java客户端代码示例
- NET/ASP.NETMVC 深入剖析 Model元数据、HtmlHelper、自定义模板、模板的装饰者模式
- Bootstrap 栅格系统
- jstat命令详解
- CodeForces 560B Gerald is into Art
- linux进程学习
- Quick to learn Python rules