Android-ListView中添加Button或者可点击TextView进行页面跳转
来源:互联网 发布:知乎机构号运营方案 编辑:程序博客网 时间:2024/03/29 18:50
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?
Context中有一个startActivity方法,Activity继承自Context,重载了startActivity方法。如果使用Activity的startActivity方法,不会有任何限制,而如果使用Context的startActivity方法的话,就需要开启一个新的task,遇到上面那个异常的,都是因为使用了Context的startActivity方法。
解决办法是,加一个flag。
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
0 0
- Android-ListView中添加Button或者可点击TextView进行页面跳转
- listview上进行ontouch事件,可滑动,可点击页面跳转
- android中如何设置点击button页面跳转
- Android中点击TextView文本链接跳转到指定页面
- Android listview的item中button的点击事件 item和button 可同时点击
- android点击button后的页面跳转
- Android ListView item中有按钮(Button)不能点击或者条目不能点击的问题
- android自定义无限轮播的轮播图,可动态添加指示点,可点击跳转页面
- 安卓ListView的Item中添加按钮后,点击Button获取点击行的TextView文本数据
- android中给TextView或者Button的文字添加阴影效果
- Android自定义点击带声音的控件TextView/Button/ListView
- Android实战简易教程<三十七>(ListView中点击button跳转到拨号界面实例)
- Android listView 中响应Button点击事件
- Android中ListView的Button点击
- Android listView 中响应Button点击事件
- Android listView 中响应Button点击事件
- Android listView 中响应Button点击事件
- ListView中添加Button后,Button的点击事件和ListView的点击事件冲突
- ubuntu 14.04 常用的配置
- ubuntu运行命令tee显示和保存为log
- Apache Solr查询语法
- spring定时器设置规则
- [iOS 项目视频] iOS视频大全-转
- Android-ListView中添加Button或者可点击TextView进行页面跳转
- Squid代理FQ失败问题处理
- Java 指定日期和日期间隔,返回间隔 之前 | 之后 的日期
- 运行gem5 ARM64 全系统
- Spring boot集成RabbitMQ
- 程序员面试金典: 9.11 排序与查找 11.6给定M*N矩阵,每一行、每一列都按升序排列,请编写代码找出某元素。
- qt上用qrencode3.4.4生成二维码显示
- Python isinstance
- Android开发之 --- 观察者模式