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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:54:10+00:00 2026-06-10T20:54:10+00:00

As the title says really. I have two columns. I want to put them

  • 0

As the title says really. I have two columns. I want to put them into textviews so I did it. However only the bottom two results, one from each column gets shown. Very odd. Here is my code: http://pastebin.com/qNgfHfT3

The parsing/onPostExecute is towards the bottom where the issue is.

One thing to note: The logs labeled “work” & “dontwork” show all my results, however the logs in the onPostExecute (Google & Google1) only show the last result so I presume the error is in the transfer from parsing to displaying.

Would really appreciate any help here. Thanks.

  • 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-10T20:54:12+00:00Added an answer on June 10, 2026 at 8:54 pm

    If you are receiving a JSON response I’d suggest you to parse it by using Gson. It’s strongly recommendable as long as you can parse the whole thing in a pair of lines.
    Note that creating a proper object it is as easy as doing the following:

    YourObject object = gson.fromJson(responseReader, YourObject.class);
    

    or even if you are retrieving a list of items:

    Type listType = new TypeToken<List<YourObject>>() {}.getType();
    List<YourObject> objects = gson.fromJson(responseReader, listType);
    

    Here’s an example that fits exactly your needs

    After the process is done you’ll have your object (or list of objects) available in an accesible variable.

    EDIT:
    First your Asynctask should have the following params:

    public class HttpTask extends AsyncTask<Void, Void, ArrayList<Driver>> {
    

    and your doInBackground method will need to pass that array to your onPostExecute:

    @Override
    protected ArrayList<Driver> doInBackground(Void... params) {
    

    For the rest, I take it when the JSon parsing starts.

    //PARSING JSON DATA
    try {
        JSONObject json_data;
        Driver d;
    
        jArray = new JSONArray(result);
        int l = jArray.length();
    
        if(l>0){
            ArrayList<Driver> drivers = newArrayListList<Driver>();
    
            for (int i = 0; i < l; i++) {
    
                json_data = jArray.getJSONObject(i);
    
                d = new Driver(json_data.optString("Driver_full_name"), json_data.optString("Drives_for"));
                drivers.add(d);
    
                Log.i("work", returnString);
                Log.i("dontwork", somethingelse);
    
            }
    
       } catch (JSONException e1) {
           Log.d("DB", "Error somewhere");
           CurrentSeasonDrivers_DriverName.this.runOnUiThread(new Runnable() {
               public void run() {
                   Toast.makeText(CurrentSeasonDrivers_DriversName, "Could not parse data so shut up", Toast.LENGTH_LONG).show();
               }
           });
       }
       return drivers;
    }
    
    protected void onPostExecute(ArrayList<Drivers>... drivers) {
    
       Log.i("Google", returnString);
       Log.i("Google1", somethingelse);
    
       String firstDriverName = drivers.get(0).name;
       String firstDriverDrivesFor = drivers.get(0).drivesfor;
    
       String secondDriverName = drivers.get(1).name;
    
       TextView drivername = (TextView) findViewById(R.id.DriverName);
       drivername.setText(firstDriverName);
    
       TextView drivesfor = (TextView) findViewById(R.id.DrivesFor);
       drivesfor.setText(firstDriverDrivesFor);
    
    }
    

    With this and an object for your driver will complete the circle.

    public class Driver{
    
        public String name;
        public String drivesfor;
    
        public Driver(String _name, String _drivesfor){
            name = _name;
            drivesfor = _drivesfor;
        }
    
    }
    

    I guess you can take over from here.
    Let me know about your progress.

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

Sidebar

Related Questions

The title says it mostly. If I have an object in Python and want
What the title says, really. I have a named pipe. I would like to
Basically, what the title says. I have several properties that combine together to really
As the title says, I want to have a build tool that quite much
As the title says really.. I have a list view with 3 text view's
Erm... what the title says really; I have a PHP script executed by an
Pretty much what the title says really. We have some code that is .NET
Basically, what the title says. I have several properties that combine together to really
Like the title says, PHP is really confusing me on a simple if comparison
As the title says, the java.io.tmpdir property in Java is really nice, and I

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.