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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:05:02+00:00 2026-05-13T08:05:02+00:00

So I have this JSON, which then my activity retrieves to a string: {popular:

  • 0

So I have this JSON, which then my activity retrieves to a string:

    {"popular":
        {"authors_last_month": [
         {
            "url":"http://activeden.net/user/OXYLUS",
            "item":"OXYLUS",
            "sales":"1148",
            "image":"http://s3.envato.com/files/15599.jpg"
         },
         {
            "url":"http://activeden.net/user/digitalscience",
            "item":"digitalscience",
            "sales":"681",
            "image":"http://s3.envato.com/files/232005.jpg"
         }
         {
            ...
         }
        ],
        "items_last_week": [
         {
            "cost":"4.00",
            "thumbnail":"http://s3.envato.com/files/227943.jpg",
            "url":"http://activeden.net/item/christmas-decoration-balls/75682",
            "sales":"43",
            "item":"Christmas Decoration Balls",
            "rating":"3",
            "id":"75682"
         },
         {
            "cost":"30.00",
            "thumbnail":"http://s3.envato.com/files/226221.jpg",
            "url":"http://activeden.net/item/xml-flip-book-as3/63869",
            "sales":"27",
            "item":"XML Flip Book / AS3",
            "rating":"5",
            "id":"63869"
         },
         {
            ...
         }],
        "items_last_three_months": [
         {
            "cost":"5.00",
            "thumbnail":"http://s3.envato.com/files/195638.jpg",
            "url":"http://activeden.net/item/image-logo-shiner-effect/55085",
            "sales":"641",
            "item":"image logo shiner effect",
            "rating":"5",
            "id":"55085"
         },
         {
            "cost":"15.00",
            "thumbnail":"http://s3.envato.com/files/180749.png",
            "url":"http://activeden.net/item/banner-rotator-with-auto-delay-time/22243",
            "sales":"533",
            "item":"BANNER ROTATOR with Auto Delay Time",
            "rating":"5",
            "id":"22243"},
         {
            ...
         }]
    }
}

It can be accessed here as well, although it because it’s quite a long string, I’ve trimmed the above down to display what is needed.

Basically, I want to be able to access the items from “items_last_week” and create a list of them – originally my plan was to have the ‘thumbnail’ on the left with the ‘item’ next to it, but from playing around with the SDK today it appears too difficult or impossible to achieve this, so I would be more than happy with just having the ‘item’ data from ‘items_last_week’ in the list.

Coming from php I’m struggling to use any of the JSON libraries which are available to Java, as it appears to be much more than a line of code which I will need to deserialize (I think that’s the right word) the JSON, and they all appear to require some form of additional class, apart from the JSONArray/JSONObject script I have which doesn’t like the fact that items_last_week is nested (again, I think that’s the JSON terminology) and takes an awful long time to run on the Android emulator.

So, in effect, I need a (preferably simple) way to pass the items_last_week data to a ListView. I understand I will need a custom adapter which I can probably get my head around but I cannot understand, no matter how much of the day I’ve just spent trying to figure it out, how to access certain parts of a JSON string..

  • 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-13T08:05:03+00:00Added an answer on May 13, 2026 at 8:05 am

    originally my plan was to have the
    ‘thumbnail’ on the left with the
    ‘item’ next to it, but from playing
    around with the SDK today it appears
    too difficult or impossible to achieve
    this

    It is far from impossible, but it will be tedious to get right, unless you use something that already wraps up that pattern for you (and that hopefully is reasonably “right”). On the Web, performance/bandwidth issues were the user’s problem — in mobile, they’re your problem.

    as it appears to be much more than a
    line of code which I will need to
    deserialize (I think that’s the right
    word) the JSON

    new JSONObject(data) is one line of code. Now, fetching the JSON, which I presume you are doing from the aforementioned URL, will be several lines of code. Neither the parsing of the JSON nor the fetching of it off the Internet is unique to Android — all of that would look the same on a desktop Java app, or a Java servlet, or whatever.

    apart from the JSONArray/JSONObject
    script I have which doesn’t like the
    fact that items_last_week is nested

    I have not had a problem parsing JSON with structures like your file exhibits. Moreover, this is hardly unique to Android — the JSON parser is used in many other Java-based projects.

    and takes an awful long time to run on
    the Android emulator

    The speed of the emulator is tied to the speed of your development machine. For me, the emulator is usually slower than actual phone hardware…and my desktop is a quad-core. Bear in mind that the emulator is pretending to be an ARM chipset running on your PC, converting ARM opcodes into x86 opcodes on the fly, so it’s not going to be fast and won’t leverage multiple cores very well.

    So, in effect, I need a (preferably
    simple) way to pass the
    items_last_week data to a ListView.

    There is nothing really built into Android to take an arbitrary JSON structure, with arbitrary data, and directly pour it into a ListView. This is not unique to JSON — XML would exhibit similar phenomenon.

    Your choices are:

    1. Create a custom ListAdapter that wraps the parsed JSON.
    2. Convert the parsed JSON into a MatrixCursor (think 2D array of data) and use a SimpleCursorAdapter.
    3. Convert the parsed JSON into an ArrayList<String> and use an ArrayAdapter.

    For the short term, option #3 is probably the simplest.

    I understand I will need a custom
    adapter which I can probably get my
    head around but I cannot understand,
    no matter how much of the day I’ve
    just spent trying to figure it out,
    how to access certain parts of a JSON
    string..

    And that question is too vague for much in the way of assistance. You might consider opening up a separate question, tagged for Java and JSON, where you get into the details of where you are having problems with the json.org parser.

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

Sidebar

Related Questions

I have a complex json array which I want to target a specific line/string
I have a web service that queries data from this json file, but I
I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM
I have this string 'john smith~123 Street~Apt 4~New York~NY~12345' Using JavaScript, what is the
I have a model with a json field. The contents of which may or
I have this PHP code echo '<a href=# onclick=updateByQuery(\'Layer3\', ' . json_encode($query) . ');>Link
I have this little function function makewindows(){ child1 = window.open (about:blank); child1.document.write(<?php echo htmlspecialchars(json_encode($row2['ARTICLE_DESC']),
I have this code in jQuery, that I want to reimplement with the prototype
I have this idea for a free backup application. The largest problem I need
I have this line in a javascript block in a page: res = foo('<%=

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.