Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fragment 跳转activity 传值问题 #58

Closed
ganzhex2019 opened this issue Apr 10, 2020 · 10 comments
Closed

fragment 跳转activity 传值问题 #58

ganzhex2019 opened this issue Apr 10, 2020 · 10 comments

Comments

@ganzhex2019
Copy link

fragment的代码
Router
.with(this@HomeTabFragment)
.host("home")
.path("more")
.putString("classifyType", sectionList[i].classifyType)
.putInt("typeId", sectionList[i].typeId)
.forward()

activity的代码
@JvmField
@AttrValueAutowiredAnno("classifyType")
var mClassifyType: String ?= null

@JvmField
@AttrValueAutowiredAnno("typeId")
var mTypeId: Int ? = null
@ganzhex2019
Copy link
Author

在activity中没有收到fragment传递过来的数据

@xiaojinzi123
Copy link
Owner

你先看下字段的引用有没有

image

@ganzhex2019
Copy link
Author

屏幕快照 2020-04-10 下午8 21 00

代码 生成了有 但是在activity中 对应的引用没有

@ganzhex2019
Copy link
Author

页面是跳转过来了的 引用就是为空

@xiaojinzi123
Copy link
Owner

既然代码生成了, 说明生成的部分没有问题.

那你可以调试一下代码. 看下 Component.inject 那句代码里面在哪一步出错了.
这样子即可排查出错误.
请把调试出来的错误信息也粘贴一下

@ganzhex2019
Copy link
Author

好的 我好像知道问题了 在文档里找到 Component.inject(this) 这句 看您的例子 找到了 谢谢

@xiaojinzi123
Copy link
Owner

....................................................................................................... 你没写这句吗?

@ganzhex2019
Copy link
Author

是的 文档里没提 自己没注意 总觉得缺少点什么 于是仔细再看了你项目的代码

@xiaojinzi123
Copy link
Owner

你别骗我撒, 文档 中很明显有这么一段:

image

这文档都很久没动了哦.

反正问题解决就好了. 我这里关闭了撒.

@ganzhex2019
Copy link
Author

谢谢 哥老关

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants