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 ...
随机推荐
- Java IO流关闭问题的深入研究
转自:https://blog.csdn.net/maxwell_nc/article/details/49151005 前几天看了一篇文章(见参考文章),自己动手试了下,发现有些不一样结论,作博客记 ...
- C++ assert 断言使用
在研究corepattern需要让程序出core, 因此用到的assert, 记录一下. 写严谨代码时,也可以使用assert进行严格的条件判断. 函数原型: #include <asser ...
- 设置让php能够以root权限来执行exec() 或者 shell_exec()
一.查看启动你php的进程的用户是谁. 可以通过在命令行执行:ps -ef | grep php来看.或者在php中执行 echo exec('whoami') 来查看.centos下默认会是nobo ...
- LSTM 文本情感分析/序列分类 Keras
LSTM 文本情感分析/序列分类 Keras 请参考 http://spaces.ac.cn/archives/3414/ neg.xls是这样的 pos.xls是这样的neg=pd.read_e ...
- 文档的js
/* 主站,子频道,定向站点共用 */ (function() { scrollToAnchor(); toggleSearchForm(); scrollTop(); initScrollBar() ...
- NSProxy
NSProxy类在分布式对象架构中是很重要的.由于作用比较特别,NSProxy在Cocoa程序中出现频率很低. NSProxy 是一个抽象类,它为一些表现的像是其它对象替身或者并不存在的对象定义一套A ...
- 算法基础:删除字符串中出现次数最少的字符(Golang实现)
描写叙述: 实现删除字符串中出现次数最少的字符.若多个字符出现次数一样,则都删除.输出删除这些单词后的字符串. 字符串中其他字符保持原来的顺序. 输入: 字符串仅仅包括小写英文字母, 不考虑非法输入, ...
- windows安装mycat(转)
http://blog.csdn.net/sc9018181134/article/details/53063798 1.先到github上下载mycat 2.下载完成后,解压.应该是这样一个样子 3 ...
- linphone
官方网站 源码下载: linphone, including: oRTP mediastreamer2 liblinphone linphonec linphone (gtk) git clone g ...
- 使用Swashbuckle.AspNetCore生成.NetCore WEBAPI的接口文档
一.问题 使用Swashbuckle.AspNetCore生成.NetCore WEBAPI的接口文档的方法 二.解决方案 参考文章:https://docs.microsoft.com/zh-cn/ ...