startActivity时报错Calling startActivity() from outside of an Activity conte
来源:互联网 发布:骑行录制软件 编辑:程序博客网 时间:2024/06/11 21:33
原因:
Context中有一个startActivity方法,Activity继承自Context,重载了startActivity方法。如果使用 Activity的startActivity方法,不会有任何限制,而如果使用Context的startActivity方法的话,就需要开启一个新的task,遇到上面那个异常的,都是因为使用了Context的startActivity方法。解决办法是,加一个flag。intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
0 0
- startActivity时报错Calling startActivity() from outside of an Activity conte
- Context启动startActivity时报错:Calling startActivity() from outside of an Activity
- startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVI
- startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVI
- startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVI
- startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVI
- startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIV
- startActivity时报错Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVI
- 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:Calling startActivity() from outside of an Activity context错误
- 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
- CentOS用户管理及分组管理(二)
- bind2nd 和 bind1st【转】
- android - anim translate中 fromXDelta、toXDelta、fromYDelta、toXDelta属性
- Webrtc Intro - RTP RTCP SDP relevants
- CSDN积分兑换
- startActivity时报错Calling startActivity() from outside of an Activity conte
- java获取System.out输出字符串
- VS2010+QT5编程之用QTabWidget写标签页(页码)的注意事项
- PHP+mysql+Highcharts实现饼状统计图
- Add Two Numbers
- 互联网热门词汇搞笑来袭
- 编译时异常和运行时异常的区别
- python mysql MySQLdb
- jquery中的prop和attr