从异步HTTP请求下载数据时如何将数据加载到reclyerview中 [英] How to load data into reclyerview while downloading them from post async http request

查看:67
本文介绍了从异步HTTP请求下载数据时如何将数据加载到reclyerview中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个android应用程序,需要使用httpclient从我的server下载数据(产品详细信息,图像),问题是我需要等到所有数据下载完毕.我需要显示已为downloaded的数据,而其他数据则为继续downloading的数据.

I am developing an android app which need's to download data(products details,images) from my server using httpclient the problem is i need to wait until all data has finished download. i need to show data which has been downloaded while other are continue downloading.

推荐答案

也许您想进行分页.社交媒体订阅源中发生的事情是一样的,向下滚动时内容将下载.例如,当您输入youtube应用程序时,Feed中会有一些视频,然后当您向下滚动时,它开始加载,然后出现一些新视频,这称为分页.

Maybe you want to do pagination. It is the same thing that happens in social media feed, the content will download as you scroll down. For example, when you enter in the youtube app there is some video in your feed and then when you scroll down, it starts loading and then some new videos appear, this is called Pagination.

这是一种复杂的方法,但是您可以通过阅读以下文章来做到这一点. Android分页指南

This is a complex approach but you can do it by reading the following articles. Paging Android Guide, Video about Paging.

阅读这些文章后,您可以按照本教程此处是本教程的源代码.

After reading these articles you can follow this tutorial, and here is the source code of this tutorial.

这篇关于从异步HTTP请求下载数据时如何将数据加载到reclyerview中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆