我的 RecyclerView 没有显示,它说没有适配器,但它有
在搜索某本书时,我尝试将一些 JSON 获取到 RecyclerView 中,对我来说一切看起来都很好,但是在搜索 RecyclerView 时却没有显示。 我在 Logcat 中收到此错误:E/RecyclerView:未连接适配器;跳过布局
这是唯一返回错误的事情,但我确实设置了 recyclerView.setAdapter(adapter);
我正在使用 Google Books API 使用手机摄像头搜索 ISBN,还可以搜索书名、作者和关键词。我的目标是在 RecyclerView 中显示搜索中的匹配/相似书籍,然后用户可以选择他想要的书籍,单击并打开另一个包含书籍信息的活动。
需要注意的几点:
- 我已经尝试了“未连接适配器;跳过 recyclerview 未附加适配器;跳过布局线程中的布局” 以及所有关联的重复线程。
这是我的 Github 存储库: ISBN 扫描仪
我不知道我现在不知道该怎么办,我对此很生气。 >:(
I tried to fetch some JSON into a RecyclerView when searching for some book, all looks fine to me, but when searching the RecyclerView doens't show up.
I got this error in Logcat: E/RecyclerView: No adapter attached; skipping layout
that's the only thing returning an error, but I did set the recyclerView.setAdapter(adapter);
I'm using Google Books API to search ISBN using the phone camera, and also search book titles, authors and keywords. My aim is to show matching/similar books from search inside the RecyclerView, then the user can choose which one he wants, click and open another activity with the book info there.
Few points to be noted:
- I've tried all the solutions for "No adapter attached; skipping
layout" in recyclerview No adapter attached; skipping layout thread
and all associated duplicate threads.
Here's my Github repo: ISBN Scanner
I don't know what to do now, I'm getting mad at this. >:(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我检查了您的存储库,发现您没有获取书单,并且在解析 json 数据时出现错误。
这是我得到的异常
对行业标识符没有价值
可能你在这里做错了什么......
在将其连接到适配器之前打印你的图书清单
另外,在 catch 块中打印异常
I have checked your repo and i have found that you are not getting booklist and getting error while parsing json data.
here what I got in exception
No value for industryIdentifiers
May be you are doing something wrong here....
print your book list before attaching it to the adapter
also, print exception in a catch block