位置: 编程技术 - 正文

Fragment中调用onActivityForResult处理(fragment的context)

编辑:rootadmin

推荐整理分享Fragment中调用onActivityForResult处理(fragment的context),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:fragment如何调用activity中的方法,fragment not attach context,fragment调用activity方法,fragment怎么用,fragment add replace,fragment调用activity方法,fragment调用另一个fragment,fragment onclick,内容如对您有帮助,希望把文章链接给更多的朋友!

The activity hosting this fragment has its onActivityResult called when the camera activity returns

My fragment starts an activity for result with the intent sent for the camera to take a picture. The picture application loads fine, takes a picture, and returns. The onActivityResult however is never hit. I’ve set break points but nothing is triggered. Can a fragment have onActivityResult? I’d think so since its a provided function. Thoughts on why this isn’t being triggered?

So I figured out the problem and will post the answer for anyone else experiencing this issue. The hosting activity overrode the onActivityResult but did not make a call to super.onActivityResult for unhandled result codes. Apparently even though the fragment is the one making the startActivityForResult call, the activity gets the first shot at handling the result. This makes sense when you consider the modularity of fragments. Once I implemented super.onActivityResult for all unhandled results, the fragment got a shot at handling the result.

Fragment中调用onActivityForResult处理(fragment的context)

And also from @siqing answer

To get the result in your fragment make sure you call : startActivityForResult(intent,);instead of getActivity().startActivityForResult(intent,); inside your fragment.

解决方法就是: 在Fragment中直接调用startActivityForResult()方法, 而不是调用 getActivity().startActivityForResult()。

stackoverflow

Android Volley框架的使用(二) 在上一篇文章中介绍了volley框架的特性,如何将volley.jar引入我们的项目,以及volley框架中最常用的两个类RequestQueueRequest基本的使用方法;这篇介绍Volley

android 一个集合问题导致不得不说的故事 啥也不说,先看图,然后给你讲需求!技能中只能添加三项,如果选择超过三个就给提示,选中的可以再次点击就是删除,这个肯定不难,但是做着发现一个问题,

Activity的四种启动模式和onNewIntent() 转自:

标签: fragment的context

本文链接地址:https://www.jiuchutong.com/biancheng/374516.html 转载请保留说明!

上一篇:JavaScript文件处理:文件读取(js的文件操作)

下一篇:Android Volley框架的使用(二)(android app 框架)

  • 应交税费借方余额0.01怎么调整
  • 支付的运输费用计入什么科目
  • 价外费用是含税价还是不含税价
  • 个体户没做过账怎么办
  • 技术服务的分录
  • 预估应付账款该怎么冲销
  • 未达账项有几种情况
  • 购进原材料发生非正常损失,账面成本10万元 该原材料
  • 延迟交款收息做什么科目?
  • 收到预付账款的分录
  • 税收返还怎么做会计分录
  • 年底员工借款如何处理
  • 餐饮会员充值赠送内帐怎么做账务处理
  • 从个人出开进的房租租赁发票可以抵扣几个点?
  • 资本公积与实收资本和盈余公积有什么区别?
  • 取得企业增值税发票
  • 二手房增值税怎么收取
  • 小型微利企业所得税优惠政策2023超过100万
  • 公司注销必须要清算报告吗
  • 医院医保统筹支付后还能报销吗
  • 企业购买自行车记账什么科目
  • 发票两边的孔怎么做
  • 退税收入怎么做分录
  • win10怎么防火墙白名单
  • 泡脚有什么好处和作用
  • 稳定用工社保补贴和岗位补贴多久发下来
  • 冲减多计提的工会经费调账说明
  • 期末余额和期初余额
  • win11系统语言修改不了
  • 扣扣斗图在哪里设置
  • PHP:Memcached::set()的用法_Memcached类
  • PHP:stream_get_filters()的用法_Stream函数
  • PHP - EasyUI DataGrid 资料取的方式介绍
  • 小规模纳税企业在应交增值税明细科目
  • 最早的手机是哪一年
  • qr code在线生成二维码
  • 长期待摊费用的摊销分录
  • 小规模纳税人增值税免税政策
  • 发票带折扣怎么开
  • nvm切换node版本后node -v报错
  • 压缩的命令
  • php curl_setopt
  • 应付款项怎么填列
  • 社会团体不属于财政拨款的对象
  • mongodb怎么用
  • 如何判断关联
  • 完税证明可以直接做账吗
  • 金税四期对纳税人的影响有哪些
  • 企业选择简易征收方案
  • 合同资产和合同履约成本的区别
  • 外商投资有限合伙企业
  • 农产品收购发票使用范围
  • 累计摊销的会计分录有哪些
  • 投资公司的投资收益算主营业务收入吗
  • 国有资产保值增值率
  • 贴现利息高好还是低好
  • 外出经营预交企业所得税税率
  • 差额征收的有哪些
  • 黄金以旧换新工具有哪些
  • 主营业务成本如何调整
  • 暂估入库成本处理
  • 减值损失和减值损失区别
  • 公司转让无形资产开什么票
  • 个税返还开票什么项目
  • 微软为什么放弃win10
  • 用注册表关闭更新
  • 升级win10免费吗
  • Win8.1不借助第三方软件怎么给文件夹加密并隐藏
  • windows7安全更新服务
  • win7怎么cmd
  • python根据ip获取主机名
  • centos7如何分区
  • js创建对象的三种方式
  • cshrc语法
  • python lxml解析xml
  • logcat read failure
  • python生成pyc
  • js如何保留一位小数
  • 南通医保2023年新政策
  • 购销合同印花税最新政策2023
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设