问题描述
我正在尝试创建一个将HTML数据解析为RecyclerView
的应用.我正在尝试使用JSoup
:
NavigationView
时会发生更改.完整代码位于 GitHub 上,我已经打开了一个问题.问题是内容无法正确加载-夸大
Fragment
后没有显示任何数据,尽管我可以看到在日志中成功创建了ArrayList
的数据.我认为问题出在
ContentAdapter
内部的ViewHolder
.我已将Log.d
放在onCreateViewHolder
和onBindViewHolder
内-加载过程中未显示任何日志. I'm trying to create an app which is parsing HTML data into RecyclerView
. Using JSoup
, I'm trying to make:
NavigationView
.Full code is on GitHub, I've already opened an issue. The thing is content doesn't load properly - after inflating
Fragment
no data is being shown, although I can see a successful creation of ArrayList
with my data in logs.I think the problem is with the
ViewHolder
inside ContentAdapter
. I've put the Log.d
inside both onCreateViewHolder
and onBindViewHolder
- no logs are shown during load process. 每个数据都是公开的,因为该应用程序是为本地赠款项目创建的-完成后也将在Play商店中发布.
Every single data there is public, as the app is being created for local grant project - it'll also be published in Play Store when finished.
在此先感谢您提供的任何帮助!
Thanks in advance for any help provided!
推荐答案
我已经找到答案了.我创建了Utils
类,用于存储最重要的值并将其传递给活动或片段.我要做的就是重新格式化 Utils
为单例模式-之前调用Utils
时,由于实例不同,没有显示任何数据.在使该类成为一个单独的类之后,就可以收集并正确显示数据.
I've found the answer already.I've created Utils
class for storing the most important values and passing them to activities or fragments. All I had to do was to reformat Utils
to singleton pattern - when I was calling Utils
previously, no data was shown because of different instances. After making this class a singleton, data was collected and displayed properly.
这篇关于使用JSoup动态加载内容-数据不会膨胀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!