英文:
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.
专注分享java语言的经验与见解,让所有开发者获益!
评论