如何解析从URL?它包含数组数JSON数据数组、数据、URL、JSON

2023-09-04 07:00:36 作者:- 禽兽大爷,

我有解析JSON数据的问题,我也跟着这链接。

i am having a issue of parsing JSON data i followed this link..

在那边已经分析的数据图像的描述。

over there it has parsing data images description..

和我也审阅这个堆栈过流谁是有同样的问题,但没有正确的答案一个人.. How解析JSONarray内JSONarray在Android的?并 How从URL显示图像?

and i also refereed this in stack over flow a guy who is having same issue but no correct answer.. How to Parse JSONarray inside JSONarray in android? and How to display Image from URL?

我们可以说,上述问题只是延伸。

we can say just extention of the above questions..

它不是一个重复的那家伙也是同样的问题,没有答案。

its not a duplicate that guy is also same problem no answer..

我有像下面

{
"request": "ok",
"query": {
    "result": [
        {
            "site": [
                {
                    "latest": [
                        {
                            "id": "2eaQy8Ow",
                            "data": "1/1/2014"
                        }
                    ]
                }
            ],
            "flag": [
                "http://www.simplydecoded.com/wp-content/uploads/2013/02/Telangana2.jpg"
            ]
        }
    ]
   }
  }

我用下面code解析

i am using below code for parsing

JSONArray json_query_flag = c.getJSONArray("flag");


JSONArray json_query_site=c.getJSONArray("site");
System.out.println("looping json_query_site");
for (int j = 0; j < c.length(); j++) {
System.out.println("looping json_query_site[" + j +"]" + "json_query_site.length() -->" + json_query_site.length());

if (j <json_query_site.length()) {

HashMap<String, String> map1 = new HashMap<String, String>();
JSONObject sd = json_query_site.getJSONObject(j);

// get latestoffers
JSONArray json_latest = sd.getJSONArray("latest");
System.out.println(json_latest.toString());

for (int k = 0; k < json_latest.length(); k++) {

HashMap<String, String> map2 = new HashMap<String, String>();
JSONObject e = json_latest.getJSONObject(k);

我的问题是,我没有得到的最​​新标志.. 可解析的问题。

My problem is that i am not getting the latest and flag.. may be parsing problem..

推荐答案

Hellow人感谢理解问题请按照this张贴的,直到你的网站,最新的..

Hellow man thanks for understanding the problem please follow this post for the till your site and latest..

它解决了我得到的文本..但问题的图像,我认为你有标志.. 对于您需要更改您的Listviewadapter.java文件。使图像将显示

it solved I am getting text.. but problem with images I think you have flag.. for that you need to change your Listviewadapter.java file. so that images will appear

改变这种像

String strflag = resultp.get(Mainactivity.IMAGES);
    if(strflag != null)
        imageLoader.DisplayImage(strflag, flag);
    else
        imageLoader.DisplayImage("https://m.xsw88.com/allimgs/daicuo/20230904/7779.png.jpg", flag);

这样我会做。

so that I will be done.