在Android中继续更新新的JSON [英] Keep Updating New JSON in Android

查看:114
本文介绍了在Android中继续更新新的JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有不断变化的JSON,我需要在android中不断更新更改,我该怎么做?

I have JSON that keep changing , I need in android to keep updating the changes , how i can do this ?

我的Android代码是

my Android code is

r = getImage();
JSONObject data = new JSONObject(r);
String a = data.getString("name");
Toast.makeText(getApplicationContext(),a, Toast.LENGTH_SHORT).show();//This prints the name

因此在此代码中,我将其放在onCreate上,因此它将执行一次,从哪里开始使其自动更新?

so in this code I have it onCreate so it will execute one time , where do I begin to make it update automatically ?

推荐答案

JSON已过时,请尝试由Google使用JSON API开发的GSON. 它提供了非常好的功能,因此此类可以转换为json格式的字符串,而另一端将json字符串取消实现并将其转换为类格式.这样就很容易处理.所有json处理都已在GSON API中完成. 尝试此gson

JSON is backdated, try GSON which is developed by google using JSON api. It provides very good functionality so that this class is converted to string in json format and the other end the json string dematerialized and convert it to class format. So that it is very easy to handle. All json processing is done into GSON api. Try this gson

希望您可以将其作为目标.

Hope you can do it as your target.

这篇关于在Android中继续更新新的JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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