Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:16:40+00:00 2026-06-15T14:16:40+00:00

My problem is when I set this two array in one list I cant

  • 0

My problem is when I set this two array in one list I cant get proper value of this two array.

Below is my json response which I get from server.
User_Label_List is not always getting but Admin_Label_List array is common.

{
    "User_Label_List": [
        {
            "iLabelID": "60",
            "vLabel": "At Ground"
        }
    ],
    "Admin_Label_List": [
        {
            "iLabelID": "53",
            "vLabel": "At School"
        },
        {
            "iLabelID": "51",
            "vLabel": "At Office"
        },
        {
            "iLabelID": "52",
            "vLabel": "At Work"
        },
        {
            "iLabelID": "50",
            "vLabel": "At None"
        },
        {
            "iLabelID": "49",
            "vLabel": "At Home"
        }
    ]
}

and this my code.

try {
                        JSONObject jsonObject = new JSONObject(result);
                        JSONArray jsonArray = jsonObject.getJSONArray("Admin_Label_List");
                        labelarray = new ArrayList<LabelModel>();
                        for (int i = 0; i < jsonArray.length(); i++) {
                            labelModel = new LabelModel();
                            JSONObject labeljson = jsonArray.getJSONObject(i);
    //                      lableList.put("iLabelID", labeljson.getString("iLabelID"));
    //                      lableList.put("vLabel", labeljson.getString("vLabel"));
                            labelModel.setLabelId(labeljson.getString("iLabelID"));
                            labelModel.setLabelName(labeljson.getString("vLabel"));
                            labelarray.add(labelModel);
                        }

                        Log.e("length", "== "+jsonObject.length());
                        if (jsonObject.length() == 2) {

                        String arryName = jsonObject.names().getString(1);
                        if (arryName.equalsIgnoreCase("User_Label_List")) {
                            JSONArray userjsonArray = jsonObject.getJSONArray("User_Label_List");
                            userlabelarray = new ArrayList<LabelModel>();
                            for (int i = 0; i < userjsonArray.length(); i++) {
    //                          userLabelModel = new UserLabelModel();
                                JSONObject labeljson = userjsonArray.getJSONObject(i);
    //                          lableList.put("iLabelID", labeljson.getString("iLabelID"));
    //                          lableList.put("vLabel", labeljson.getString("vLabel"));
                                labelModel.setLabelId(labeljson.getString("iLabelID"));
                                labelModel.setLabelName(labeljson.getString("vLabel"));
                                userlabelarray.add(labelModel);
                            }

    //                      userlabelarray.addAll(labelarray);
                        }
                        List<LabelModel> union = new ArrayList<LabelModel>(labelarray);
                        union.addAll(userlabelarray);
                        customeLabelAdpater = new CustomeLabelAdpater(ChooselabelActivity.this, lableList);
                        listView.setAdapter(customeLabelAdpater);
                        }

so can any one suggest me how can I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:16:41+00:00Added an answer on June 15, 2026 at 2:16 pm

    You are not initializing your LabelModel in second time, while you are filling your second array data, Can you please reinitialize your LabelModel,

    don’t worry about previous data you already filled, so while filling next array data you have to reinitialize your LabelModel, hope it will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this problem while doing some experiment with set . I use a
I have no good title for this question, but my problem is to set
I have this problem decomposing a relation schema into a set of schemas that
I have a problem with this is code: Set oXmlHTTP = CreateObject(Microsoft.XMLHTTP) oXmlHTTP.Open POST,
I'm trying to solve this problem in a pure-functional way, without using set! .
I have a problem with a javascript set of functions that I made. This
i get a problem to set the callback function before indexeddb add transaction os
The problem: I have set of pictures, when the user presses on one of
I have two set of arrays in different MYSQL table. This what I want
I'm working on a practice problem set for C programming, and I've encountered this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.