在创建一个Android的更新天气预报应用程序 [英] Creating a Weather Update Application in Android
问题描述
我想创建应用程序,将显示city.I的天气更新已经尝试了本我的2种方式。
I am trying to create application that will show the weather update of the city.I have tried this my 2 ways
1.我已经使用的AsyncTask对于与获得()
所以等到响应来自我使用显示waether更新的API。
1.I have used AsyncTask for that with .get()
so wait till the response comes from the API that i am using to show waether update.
2.In中的AsyncTask在 onPostExecute
我已经做到了我已经从服务器接收值的所有设置。
2.In the AsyncTask in the onPostExecute
i have done all setting of the values that i have received from the server.
但问题是它正在采取的很多时间,直到响应来自服务器开拓活动1路。
But the issue is on the 1 way it is taking to much of time to open up the activity till the response comes from the server .
在2路活动很快打开了,但响应来自服务器后的值将被更新。
On the 2 way the activity opens up quickly but the values are updated after the response comes from the server.
我想这样做,因为它迅速打开而不采取time.So是存在的,我们能做到这一点,以便它不花时间任何其他方式。
I want to do it as it open up quickly without taking time.So is there any other way we can do this so that it don't take time .
请建议我有什么办法跟着得到这个,我们可以使用一些类型的缓存来保存图像的URL和温度,湿度
Please suggest what approach i have to follow to get this,can we use some kind of caching to save the images url and temp,humidity
推荐答案
使用凌空图书馆,有一个谷歌IO 2013谈它,很多例子可以搜索。
Use the Volley library, there's a Google IO 2013 talk on it and lots of examples you can search for.
<一个href=\"https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&ved=0CDgQFjAB&url=https://developers.google.com/events/io/sessions/325304728&ei=wLdPUqi5Jeel0AWTsICoBg&usg=AFQjCNEyT1AnZrgVSp1BDzOBwgHglo9UpQ&sig2=Da3nPIBg0kHEkq19APp5HA&bvm=bv.53537100,d.d2k\"相对=nofollow>排球 - 谷歌IO 2013
这篇关于在创建一个Android的更新天气预报应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!