07-18 16:34:05.891: E/AndroidRuntime(18396): FATAL EXCEPTION: main
07-18 16:34:05.891: E/AndroidRuntime(18396): android.util.AndroidRuntimeException:

Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
07-18 16:34:05.891: E/AndroidRuntime(18396):     at android.app.ContextImpl.startActivity(ContextImpl.java:971)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at android.content.ContextWrapper.startActivity(ContextWrapper.java:283)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at com.txrj.sms.service.ReceiveMsgService$1.handleMessage(ReceiveMsgService.java:37)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at android.os.Looper.loop(Looper.java:137)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at android.app.ActivityThread.main(ActivityThread.java:4517)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at java.lang.reflect.Method.invokeNative(Native Method)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at java.lang.reflect.Method.invoke(Method.java:511)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
07-18 16:34:05.891: E/AndroidRuntime(18396):     at dalvik.system.NativeStart.main(Native Method)

在ReceiveMsgService(extends Service)中,添加addFlags()方法。

Intent it = new Intent(mContext, ShowSmsActivity.class);
it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(it);

requires the FLAG_ACTIVITY_NEW_TASK flag的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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的话,需 ...

  7. 兔子--Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK

    错误原因: Activity打开别的Activity的时候会默认把新的Activity放到自己的task中,所以不用指定,可是别的地方就得指定了. 解决的方法:intent.addFlags(Inte ...

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

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

  9. Android 启动模式及常用的Intent的Flag

    LaunchMode 在声明Activity的xml中指定 android:launchMode="xxx" standard 标准模式.这是系统默认的模式,每次启动Activit ...

随机推荐

  1. Tomcat6和Tomcat7配置SSL通信的比较

    <Tomcat6和Tomcat7配置SSL通信的比较> 作者:chszs,转载需注明.博客主页: http://blog.csdn.net/chszs 在项目开发过程中,尝尝会遇到Tomc ...

  2. WinCE程序调试方法【转】

    刚刚接触WinCE编程,感觉大部分跟WinForm一样.刚开始的时候,不知道怎么进行断点调试,后来同事告诉我,可以直接连接进行断点调试,一试之下,果然好用,所以拿出来分享一下. 必备工具: Micro ...

  3. [leetcode]Candy @ Python

    原题地址:https://oj.leetcode.com/problems/candy/ 题意: There are N children standing in a line. Each child ...

  4. ASP.NET网站管理工具的【安全】功能无法使用问题

    在使用ASP.NET网站管理工具时,安全出现下面的问题: 出现这种情况的主要原因是,安全管理中需要创建用户和角色信息,所以要用到数据库,但是你没有设置好数据库. 可以打开vs自带的命令提示工具: 打开 ...

  5. 理解MySQL数据库覆盖索引 (转)

    http://www.cnblogs.com/zl0372/articles/mysql_32.html 话说有这么一个表: CREATE TABLE `user_group` ( `id` int( ...

  6. 转: linux进程地址图解

    http://www.cnblogs.com/clover-toeic/p/3754433.html

  7. Angular入门笔记

    AngularJS(下面简称其为ng)是Google开源的一款JavaScript MVC框架,弥补了HTML在构建应用方面的不足,其通过使用指令(directives)结构来扩展HTML词汇,使开发 ...

  8. GPUImage API文档之GLProgram类

    GLProgram是GPUImage中代表openGL ES 中的program,具有glprogram功能. 属性 @property(readwrite, nonatomic) BOOL init ...

  9. Springmvc 上传文件MultipartFile 转File

    转自:http://blog.csdn.net/boneix/article/details/51303207 业务场景:ssm框架 上传文件到应用服务器过程中要传到专有的文件服务器并返回url进行其 ...

  10. MogileFS与FastDFS的个人见解

    MogileFS与FastDFS的个人见解 六月 9, 2013 1 条评论 MogileFS & FastDFS 为两个开源分布式文件系统,都主要适用于互联网文件共享,上传,下载等功能,主要 ...