错误原因:

Activity打开别的Activity的时候会默认把新的Activity放到自己的task中,所以不用指定,可是别的地方就得指定了。

解决的方法:intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

***********************************************下面属于了解学习******************************************************

标志位的意义:

《1》.FLAG_ACTIVITY_NEW_TASK:

假设设置了此标志。这个activity将成为一个新task(包括一系列Activity的堆栈, 遵循先进后出原则)的历史堆栈中的第一个activity。

这个task定义了一个原子组activities,用户能够对其进行移除。各种tasks能够移到前面或者后面;在一个特定的task中,全部的activities总是保持同样的顺序。

《2》.FLAG_ACTIVITY_MULTIPLE_TASK

当使用这个标志时。假设一个包括此activity的task已经执行了。新的activity不会启动。同一时候。当前的task将简单的被提到窗体最前面。

查看FLAG_ACTIVITY_MULTIPLE_TASK能够禁止这个行为。

兔子--Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK的更多相关文章

  1. Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK fla

      转载于 http://blog.csdn.net/wike163/article/details/6678073    从一个Activity中要通过intent调出另一个Activity的话,需 ...

  2. Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

    Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK fla ...

  3. android.util.AndroidRuntimeException Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? com.uethinking.microvideo.manag

    记录学习,网络摘抄 碰到这个异常其实这个上面说的很清楚,加个flag 从一个Activity中要通过intent调出另一个Activity的话,需要使用 FLAG_ACTIVITY_NEW_TASK ...

  4. startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag

    startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVI ...

  5. Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag.

    https://blog.csdn.net/watermusicyes/article/details/44963773 Context中有一个startActivity方法,Activity继承自C ...

  6. Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

    安卓出现如下错误,需要增加FLAG_ACTIVITY_NEW_TASK标志 Intent intent1 = new Intent(getApplicationContext(), CameraAct ...

  7. Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW _TASK flag.

    在Activity中使用startActivity()方法不会有任何限制,因为Activity重载了Context的startActivity()方法.但是如果是在其他地方(如Widget或Servi ...

  8. startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVI

    原代码如下: Intent intent = new Intent(); intent.setClass(mContext, PhotoView.class); Bundle bundle = new ...

  9. Calling startActivity() from outside of an Activity

    在Activity中使用startActivity()方法不会有任何限制,因为Activity重载了Context的startActivity()方法.但是如果是在其他地方(如Widget或Servi ...

随机推荐

  1. AOP概念

    在软件业,AOP为Aspect Oriented Programming的缩写,意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术.AOP是OOP的延续,是软件开发中的 ...

  2. Sublime Text Packages Control 安装

    一.简单的安装方法 使用Ctrl+`快捷键或者通过View->Show Console菜单打开命令行,粘贴如下代码: import urllib.request,os; pf = 'Packag ...

  3. Node.js 参考学习地址

    前段时间研究过Node.js 自从由于笔记本硬盘崩了之后就很少在家里搞程序了,但是很想学习之,只因最近在努力学习英文.技术之外的事也需要做好,我们毕竟不是为了技术而生,技术是我们生存的一门得力技能,唯 ...

  4. 重新mysql-server

    apt-get purge mysql-server │apt-get purge mysql-common │rm -rf /var/log/mysql │rm -rf /var/log/mysql ...

  5. poj 1458 Common Subsequence_最长公共子串

    题意:略 求最长公共子串 #include<iostream> #include<cstdio> #include<string> using namespace ...

  6. 【C/C++】Linux下system()函数引发的错误

    http://my.oschina.net/renhc/blog/54582 [C/C++]Linux下system()函数引发的错误 恋恋美食  恋恋美食 发布时间: 2012/04/21 11:3 ...

  7. 网易云课堂_C语言程序设计进阶_期末考试编程题部分

    1 字符串循环右移(5分) 题目内容: 输入一个字符串和一个非负整数N,要求将字符串循环右移N次. 输入格式: 输入在第1行中给出一个字符串,以'#'表示结束,‘#’不是字符串的一部分,字符串的长度未 ...

  8. hdu 2660 Accepted Necklace(dfs)

    Problem Description I have N precious stones, and plan to use K of them to make a necklace for my mo ...

  9. OC基础9:预处理程序

    "OC基础"这个分类的文章是我在自学Stephen G.Kochan的<Objective-C程序设计第6版>过程中的笔记. 1.  关于#define语句: (1). ...

  10. check cable connection PXE-M0F: Exiting intel PXE ROM no bootable device-- insert boot disk and pre

    今天修电脑遇到一个问题,新买的电脑的原装的是linux,然后我按常规方式进入PE后重装系统,然后开机一直显示下面的代码,进不去: check cable connection PXE-M0F: Exi ...