zoukankan      html  css  js  c++  java
  • Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK fla

    从一个Activity中要通过intent调出另一个Activity的话,需要使用 FLAG_ACTIVITY_NEW_TASK 
    否则的话,会有force close: 
    03-01 18:49:37.888 E/AndroidRuntime( 2706): FATAL EXCEPTION: main 
    03-01 18:49:37.888 E/AndroidRuntime( 2706): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? 

    FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS: 

    如果调出的Activtivity只是一个功能片段,并没有实际的意义,也没有必要出现在长按Home键调出最近使用过的程序类表中,那么使用FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS 

    Intent intent = new Intent(this, WaitingFallBackDialog.class); 
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); 
    startActivity(intent); 


  • 相关阅读:
    session的生命周期
    临远的spring security教程
    spring security原理图及其解释
    解决eclipse中出现Resource is out of sync with the file system问题
    从SOA到BFV【普元的一份广告文章】
    普元OA平台介绍
    门户平台
    企业门户平台解决方案
    使用 CAS 在 Tomcat 中实现单点登录
    CAS 跨域原理
  • 原文地址:https://www.cnblogs.com/liupengcheng/p/5069997.html
Copyright © 2011-2022 走看看