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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:07:27+00:00 2026-06-18T10:07:27+00:00

Im trying to display my array soap action result to listview. I managed to

  • 0

Im trying to display my array soap action result to listview. I managed to retrieve the items and store it as string, however, I cant seem to put all of the string into the listview. What am i doing wrongly?? When I Log.d, it displays everything in the correct order (Which is what I want). However when I add it to my SearchResults, it only display the last details.

 try
            {
                androidHttpTransport.call(SOAP_ACTION, envelope);
                SoapObject response = (SoapObject)envelope.getResponse();

                for (int i = 0; i < response.getPropertyCount(); i++) {
                    Object property = response.getProperty(i);
                    if (property instanceof SoapObject) {

                        ArrayList<SearchResults> results = new ArrayList<SearchResults>();
                         SearchResults sr1 = new SearchResults();

                      SoapObject info = (SoapObject) property;
                      String description = info.getProperty("description").toString();
                      String name = info.getProperty("name").toString();
                      String date = info.getProperty("date").toString(); 

                        Log.d("This is the list of id:",description);
                        Log.d("This is the list of name:",name);
                        Log.d("This is the list of date:",date);

                 sr1.setDescription(description);
                     sr1.setName(name);
                     sr1.setDate(date);                 
                     results.add(sr1);

                       final ListView lv1 = (ListView) findViewById(R.id.ListView01);
                       lv1.setAdapter(new MyCustomBaseAdapter(this, results));

                       lv1.setOnItemClickListener(new OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> a, View v, int position, long id) { 
                         Object object = lv1.getItemAtPosition(position);
                         SearchResults fullObject = (SearchResults)object;
                         Toast.makeText(second.this, "You have chosen: " + " " + fullObject.getName(), Toast.LENGTH_LONG).show();

                      //   return;
                        }  
                      });  
             }
           }
         }
  • 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-18T10:07:28+00:00Added an answer on June 18, 2026 at 10:07 am

    Its because you are creating a new ArrayList everytime inside a for loop, so its over-writing the last data inside the ArrayList created.

    It should be like,

    ArrayList<SearchResults> results = new ArrayList<SearchResults>();
    for (int i = 0; i < response.getPropertyCount(); i++) {
      SearchResults sr1 = new SearchResults();
      // fetch results
    } 
    // update the List
    ListView lv1 = (ListView) findViewById(R.id.ListView01);   
    lv1.setAdapter(new MyCustomBaseAdapter(this, results));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display an array of items with Mustache, and I'd like to
I am trying to display an array which by itself is no issue. However,
I am trying to display string array in JSP page. I have got a
I'm trying to display the items in an array using the following: NSString *alertString
Trying to display a list of contacts using a Custom Array Adapter. However every
I am just trying to display a list from an array that I have
I'm trying to create an array to display the last 5 products a customer
I am trying to format an array of numbers to display in an array
I have an array of Person pocos, populated below. I'm trying display them alphabetically
I am trying to display data of an an associative array in a table

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.