requires the FLAG_ACTIVITY_NEW_TASK flag
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的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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的话,需 ...
- 兔子--Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK
错误原因: Activity打开别的Activity的时候会默认把新的Activity放到自己的task中,所以不用指定,可是别的地方就得指定了. 解决的方法:intent.addFlags(Inte ...
- Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW _TASK flag.
在Activity中使用startActivity()方法不会有任何限制,因为Activity重载了Context的startActivity()方法.但是如果是在其他地方(如Widget或Servi ...
- Android 启动模式及常用的Intent的Flag
LaunchMode 在声明Activity的xml中指定 android:launchMode="xxx" standard 标准模式.这是系统默认的模式,每次启动Activit ...
随机推荐
- 第二章 TypeScript 开发环境搭建
Mac OS X 下 TypeScript 开发环境搭建 一.集成开发环境 WebStrom VSCode 二.安装 TypeScript Homebrew(macOS 缺失的软件包管理器) ruby ...
- JS 父页面调子页面(2种情况),子掉父级(1种)(转)
A :父级调用子级页面 ,非IFRAME情况,类似平级: window.open("子页面.html", "", "width=1024,height ...
- Java-JUC(六):创建线程的4种方式
Java创建线程的4种方式: Java使用Thread类代表线程,所有线程对象都必须是Thread类或者其子类的实例.Java可以用以下4种方式来创建线程: 1)继承Thread类创建线程: 2)实现 ...
- 阿里云centos配置nginx和nodejs
今天新买了阿里云,想把网站跑起来,于是记录跑起来的过程 1.购买域名 2.购买解析 3.购买ecs主机 4.ssh登录主机 5.安装vsftpd 6.配置ftp用户.文件夹.权限 7.安装nginx/ ...
- 命令行下从bak文件恢复sqlserver数据库方法
命令行下从bak文件恢复sqlserver数据库方法 注:本文所示访问从SqlServer 2000 - 2014版都是通用的 参考:http://blog.sina.com.cn/s/blog_5c ...
- [Functional Programming] Using Last monoid with Maybe
Imaging we have a deck of cards, eveytimes we need to pick one card from deck, the result we want to ...
- QQList列表功能实现
1.模型 @class FriendsModel; @interface GroupModel : NSObject @property (nonatomic, copy) NSString *nam ...
- Discuz!X/数据库操作方法
原DB类的改进 Discuz! X2.5新版对数据库DB层进行了功能和安全方面的加强: addslashes的处理 仅insert(),update(),delete() 方法对传入其的数组形式的参数 ...
- iOS的settings bundle中开关button(Toggle Switch)取不到值的问题
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 假设认为写的不好请多提意见,假设认为不错请多多支持点赞.谢谢! hopy ;) 在Xcode7.2中设置App的settings bundle ...
- java parse 带英文单词的日期字符串 转 date (转化新浪微博api返回的时间)
拂晓风起 专注前端技术cocos2d.js.flash.html5,联系:kenkofox@qq.com.如果读者要找腾讯工作机会,请不吝推荐简历. 博客园 首页 新闻 新随笔 联系 管理 订阅 随笔 ...