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 6184363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:31:31+00:00 2026-05-24T01:31:31+00:00

Still working on this part of my script to parse my JSON jsonArray =

  • 0

Still working on this part of my script to parse my JSON jsonArray = new JSONArray(jsonData); and then adding it to a arraylist “myJSONArray”

I am not sure how the for loop would work to add my elements from jsonArray into myJSONArray (arrayList)

If I am not clear please let me know and if there is any info I am missing just ask. Thanks in advance.

JSON data:

{"id":["1","2","3"],"name":["Dragon","Butterfly","Tattoo"],"thumb":["thm_polaroid.jpg","thm_default.jpg","thm_enhanced-buzz-9667-1270841394-4.jpg"],"path":["polaroid.jpg","default.jpg","enhanced-buzz-9667-1270841394-4.jpg"]}

image_data class:

public class image_data {


    public int id;
    public String name;
    public String thumb;
    public String path;


}

ShowThumb class:

public class showThumb extends Activity{



    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gridlayout);

         Bundle bundle = getIntent().getExtras();
         String jsonData = bundle.getString("jsonData");


         JSONArray jsonArray = null;
        try {
            jsonArray = new JSONArray(jsonData);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        ArrayList<image_data> myJSONArray = new ArrayList<image_data>();

         for (int i=0; i<jsonArray.length(); i++) {
               **//This is where I think I create the seperate arrays of id name thumb and path**
             myJSONArray.add(new image_data());

         }


GridView gridview = (GridView) findViewById(R.id.gridview);
        gridview.setAdapter(new ImageAdapter(this,image_data));

    }
}
  • 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-05-24T01:31:33+00:00Added an answer on May 24, 2026 at 1:31 am

    How you iterate and add

     for(int i=0;i<jsonArray.length;i++)
        {    
             JSONObject json_data = jArray.getJSONObject(i);
             imgnfo.id =  json_data.getInt("id_key");
             imgnfo.name = json_data.getString("name_key");
             imgnfo.thumb = json_data.getString("thumb_key");
             imgnfo.info = json_data.getString("info_key");
             myArray.add(new image_data());
        }
    

    Just add proper keys names. I didn’t know them.

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

Sidebar

Related Questions

Spent the good part of this morning working through this, but still…. apologies if
I'm still working with this huge list of URLs, all the help I have
Still working on lisp recipes and idioms. I have a list like this: ((a
I've been trying to get this Sudoku game working, and I am still failing
I'm still working on a particular RDF file, but seems that something is not
$string = preg_replace(#[name=([a-zA-Z0-9 .-]+)*]#,''.$1,$string); This part of script doesn't work: str_replace(' ', '-', $1)
I am working on a comment script using ajax, json and jquery. I have
I'm trying this part of my script and it work perfectly if win32gui.GetCursorInfo()[1] ==
Still working through JQuery to get data and repopulate portions of a page. Right
I'm still working on groking the F# thing - trying to work out how

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.