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

查看:14
本文介绍了如何在从 post async 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 应用程序时,您的提要中有一些视频,然后当您向下滚动时,它开始加载,然后出现一些新视频,这称为分页.

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.

这是一种复杂的方法,但您可以通过阅读以下文章来实现.Paging 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.

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

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