[已解决] android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
来源:互联网 发布:北京软件开发 编辑:程序博客网 时间:2024/06/06 03:18
08-25 19:39:07.280 1527-1527/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.wbm.app.tvad, PID: 1527
java.lang.RuntimeException: Unable to start receiver com.wbm.app.receiver.TvStartReceiver: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2419)
at android.app.ActivityThread.access$1700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5008)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:811)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:627)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:1049)
at android.app.ContextImpl.startActivity(ContextImpl.java:1036)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:311)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:311)
at com.wbm.app.receiver.TvStartReceiver.openApp(TvStartReceiver.java:69)
at com.wbm.app.receiver.TvStartReceiver.onReceive(TvStartReceiver.java:36)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2412)
at android.app.ActivityThread.access$1700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5008)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:811)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:627)
Process: com.wbm.app.tvad, PID: 1527
java.lang.RuntimeException: Unable to start receiver com.wbm.app.receiver.TvStartReceiver: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2419)
at android.app.ActivityThread.access$1700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5008)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:811)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:627)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:1049)
at android.app.ContextImpl.startActivity(ContextImpl.java:1036)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:311)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:311)
at com.wbm.app.receiver.TvStartReceiver.openApp(TvStartReceiver.java:69)
at com.wbm.app.receiver.TvStartReceiver.onReceive(TvStartReceiver.java:36)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2412)
at android.app.ActivityThread.access$1700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5008)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:811)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:627)
at dalvik.system.NativeStart.main(Native Method)
解决办法:
启动之前设置flagintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
0 0
- [已解决] android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- Activity跳转:android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- Android—android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context r
- 正则表达式
- JS利用正则配合replace替换指定字符
- VS2010 c++生成和调用dll例子
- 高德地图
- Android消息处理机制(Handler、Looper、MessageQueue与Message)
- [已解决] android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- 会说话
- Ajax 详解
- Android 中 判断某个字段是否包含中文
- BOM制作系列之二:BOM合并
- Android项目总结
- Java基础之反射
- POJ 1328
- Shader特效——“Voronoi 图像”的实现 【GLSL】