使用HttpURLConnection在RecyclerView中创建数据检索列表。

huangapple 未分类评论48阅读模式
英文:

Create List of Data Retrieved using HttpURLConnection in RecyclerView

问题

我对Android开发还不熟悉,所以请容忍一下。

我正在尝试使用HttpURLRequest来检索一系列项目,并将它们填充到RecyclerView中。我将web请求在单独的线程中运行,但是我很难弄清楚如何将结果传递到UI界面。我尝试过从其他线程更新适配器,但是它告诉我不能从该线程进行更新。

所以问题是,从web中获取列表并在RecyclerView中显示结果的最佳做法是什么。

英文:

I'm new to Android development so please bear with me.

So I am trying to use HttpURLRequest to retrieve a list of items and populate those into a RecyclerView. I am running the web request in a separate thread, but I am having a hard time figuring out how to get the results into the UI. I've tried updating the adapter from the other thread but it tells me I can't update from that thread.

So question is, what is best practice for fetching a list from the web and displaying the results in a RecyclerView.

huangapple
  • 本文由 发表于 2020年5月5日 10:43:34
  • 转载请务必保留本文链接:https://java.coder-hub.com/61604851.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定