位置: 编程技术 - 正文

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

发布时间:2024-02-27

推荐整理分享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 框架)

  • 预收账款怎么做财务分析报告
  • 专票没有抵扣联可以作废吗
  • 什么时候过路费是半价
  • 公司承担社保能放到生产成本里吗
  • 员工在公司食堂就餐被烫伤医药费由谁承担
  • 发票入账时间规定是多久
  • 社保如何会计处理
  • 电梯折旧费如何分摊
  • 购买的职业险计入哪个科目
  • 支付给其他公司费用怎么入账
  • 固定资产本期折旧额与上期不一样
  • 微信支付的钱到哪里去了
  • 每月能领多少专利费
  • 实收资本增加印花税缴纳时间
  • 购入增值税税控系统专用设备为什么全额计入固定资产
  • 工资里税前扣款是什么意思
  • 银行手续费抵扣税率是多少
  • 托收凭证的会计科目
  • 运输发票车种车号要求 自有车
  • 汇缴交的所得税如何做账
  • 总资产净利率与权益乘数的关系
  • 加工费的会计处理
  • 个人所得税如何退税操作步骤
  • 网速突然变差是什么原因
  • c 盘清理
  • 被收购企业会提出什么条件
  • PHP:apache_get_version()的用法_Apache函数
  • 企业投资入股的几种方式
  • 结转存货的成本叫什么
  • inclooder.exe
  • linux的网络编程
  • 企业发放误餐补助需要票据吗
  • 会计政策变更追溯调整为什么不影响所得税
  • php编程计算日期怎么算
  • vue项目移动端怎么做适配
  • unet bn
  • 深度卷积神经网络基本结构
  • 投稿p2
  • 10-Ajax&Vue
  • 税收分类编码不存在什么意思
  • 减免残保金的操作方法
  • 房租增值税怎么计算
  • python3 yaml模块
  • 浅谈php设计模式的理解
  • sql server ssrs
  • 企业有什么税收
  • 增值税发票认证勾选平台
  • 增值税发票价税合计不能超过多少
  • 找到一款
  • sql聚合语句
  • mysql 索引 key
  • 关于发票的相关法律
  • 企业专利权拥有人是指
  • 服务费发票的税率
  • 设备安装成本怎么结转
  • 工资发多了可以追回吗
  • 哪些合同需要缴税
  • 清理固定资产是什么意思
  • 收到联营单位投入的款项98600元存入银行
  • 支付银行手续费等直接收费金融服务
  • 需求价格弹性是ep还是ed
  • mysql连接查询的几种方式
  • 深入浅出了解啥意思
  • bios单词
  • lsf.exe是什么
  • win10浏览器下载不了软件怎么回事
  • win8开始菜单全屏怎么调回去
  • 游戏中的物理 processing
  • 怎么检测端口通不通
  • bootstrap滚动监听效果
  • js网页自动化
  • shell脚本实现自动化巡检报警发送邮箱
  • Android自定义控件开发入门与实战 百度网盘
  • js实现拖拽div的弹出框
  • android 5.1 WIFI图标上的感叹号及其解决办法
  • python html转markdown
  • 海口市地税局高峰简历
  • 如何在国税网查企业年金
  • 广东省地方税务局电子办税服务厅
  • 房没交契税和物业维修金房屋预告登记证明可以打印吗
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号