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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:13:01+00:00 2026-05-30T11:13:01+00:00

I have a code which does following – Connect to a web service via

  • 0

I have a code which does following –

  1. Connect to a web service via HttpClient to PHP file
  2. Returns a result from an SQL query
  3. Returns format is a jArray (a JSONArray)

for(int i=0; i < jArray.length() ; i++) {
    json_data = jArray.getJSONObject(i);
    int id=json_data.getInt("id");
    String name=json_data.getString("name");
    Log.d(name,"Output");
}

When I look at the LogCat, I see all the “names” of the query, Each record is printed. I just need to plug these results into a ListView. How can I accomplish this ?

PS – I do not have a separate class for an ArrayAdapter. Could this be the reason ?

  • 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-30T11:13:03+00:00Added an answer on May 30, 2026 at 11:13 am

    If you just want to display a list of textViews you don’t need to override anything, you can just add all of the items into an arrayList and use an arrayAdapter.

    Put a list view in your xml that is named android:list and then create your arrayAdapter with the textView you want to use.

    After that all you have to do is call setListAdapter(mArrayAdapter) and it should populate your list.

    ArrayList<String> items = new ArrayList<String>();
    for(int i=0; i < jArray.length() ; i++) {
        json_data = jArray.getJSONObject(i);
        int id=json_data.getInt("id");
        String name=json_data.getString("name");
        items.add(name);
        Log.d(name,"Output");
    }
    
    ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String>(this,  
               android.R.layout.simple_expandable_list_item_1, items));
    setListAdapter(mArrayAdapter)
    

    hope this helps!

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

Sidebar

Related Questions

I have the following code which could be called via multiple web-requests at the
I have the following JQuery code which does similar functionality like Stackoverflow where the
I have the following JavaScript code: Link In which the function makewindows does not
I have written the following code which will does not work but the second
I have some code which does the following: const string KEY_CHK = Microsoft.IW.PartCheck; SPWeb
I have the following code which does nothing but reading some values from a
I have the following code which does what it's supposed to do: objSQLCommand =
I have following code which works as is, but does not work when cache=T
i have following code,which does not show me anything #include <iostream> using namespace std;
I have the following code which does a function similar to the way the

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.