1.在,要执行退出的activity中进行相关配置
 
public static final String ALL_EXIT = "COM.DEVDIV.TEST.EXIT";// 申明通知
 
 【使用】
public static void fullExit(Context context) {
Intent intent = new Intent(context, WelcomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setAction(APP.ALL_EXIT);
context.startActivity(intent);
}
 
 
2.在初始页面重写方法
 
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent.getAction().endsWith(APP.ALL_EXIT)) {
finish();
System.exit(0);
}
}
 
@Override
protected void onDestroy() {
super.onDestroy();
finish();
System.exit(0);
}
 
3.在配置文件中初始Activity中添加配置【android:launchMode="standard"】
 
              android:name=".WelcomeActivity"
            android:launchMode="singleTop"
            android:screenOrientation="portrait" >
           
               


               
           

       

更多相关文章

  1. 【Android Demo】获取指定网页的页面源代码
  2. Android HttpUrlConnection 发送Post请求 PHP页面$_POST接收不到
  3. android快速点击生成两个相同页面的解决办法
  4. Android:Activity、Fragment、Adapter分别跳转到Activity页面的方
  5. 重写gallery 的 BaseAdapter
  6. Android打造不一样的新手引导页面(一)
  7. Android启动页面整理
  8. android 使用浏览器打开指定页面

随机推荐

  1. 安卓系统新手入门教程
  2. 移动开发参考书之Android篇
  3. Android入门第十六篇之Style与Theme
  4. 教你用电脑从 Google Play 下载 Android(
  5. Android(安卓)仿滴滴首页嵌套滑动效果
  6. Android(七):从多方面理解Android体系结构
  7. Android中VideoView及SurfaceView视频播
  8. Android基于腾讯X5内核的WebView(超级浏
  9. Android实现图表绘制和展示
  10. Android(安卓)中Seekbar详解及简单实例