从服务器上获取数据,并刷新UI当数据被取出? [英] Fetch data from server and refresh UI when data is fetched?

查看:94
本文介绍了从服务器上获取数据,并刷新UI当数据被取出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从服务器上获取数据,并刷新UI时的数据是在Android中取出。

I want to fetch data from server and refresh UI when data is fetched in Android.

我应该怎么使用?一个AsyncTask的或服务还是其他什么东西?

What should I use? an AsyncTask or a Service or something else?

推荐答案

您可以使用异步任务,这台屏幕的内容查看(版面)的方法。 在数据已经从服务器获得的,你可以通过调用)的AsyncTask的postexecute的方法(刷新屏幕。

You can use the Async task and a method which sets the contentview (layout) of your screen. After the data has been fetched from the server, you can again refresh the screen by calling the method in postexecute() of Asynctask.

这篇关于从服务器上获取数据,并刷新UI当数据被取出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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