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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:46:27+00:00 2026-05-23T08:46:27+00:00

in my app i am using a list view. The data which i want

  • 0

in my app i am using a list view. The data which i want to list out are from a database of my app and an xml server database.

For example i am getting some two set of data from server and store it in a array as follows

firstname = {arun, Arun, Rajesh} 
lastname  = {kumar, sundar, kannan}

Now again i am getting some data from my app database and store it in array as follows

first = {arul}
last  = {raj}

Now i have combined the array list together as follows

firstname.addAll(first);
lastname.addAll(last);

Now i have the output as

{arun, Arun, Rajesh, arul} 
{kumar, sundar, kannan, raj}

Now i want to list out these items as in the following image
enter image description here

how to do this, please help me……

  • 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-23T08:46:28+00:00Added an answer on May 23, 2026 at 8:46 am

    If you finally get all your firstname and lastname in two separate array then it is very simple to display on ListView as you want

    first create a layout which has a listview element lets us name main.xml

    then create a another layout having two TextView in Horizontal layout orientation let us name mainitem.xml

    so now you create a new activity then call setContentView(R.layout.main)

    then retrive list view

    and now create a adapter by following code

    this code is in onCreate(Bundle b) method

    ListView lv= (ListView)findViewById(R.id.listview1);
    
            // create the grid item mapping
            String[] from = new String[] {"col_1","col_2"};
            int[] to = new int[] { R.id.firstname, R.id.secondname};
    
            // prepare the list of all records
            List<HashMap<String, String>> fillMaps = new ArrayList<HashMap<String, String>>();
            for(int i = 0; i <firstname.length && lastname.length; i++)
            {
                HashMap<String, String> map = new HashMap<String, String>();
                map.put("col_1",firstname[i]);
                map.put("col_2",lastname[i]);
                fillMaps.add(map);
            }
    
            // fill in the grid_item layout
            SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.mainitem, from, to);
            lv.setAdapter(adapter);
    

    create mainitem.xml file having two TextView which id are 1)R.id.firstname, 2) R.id.lastname in layout horizontal orientation

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

Sidebar

Related Questions

I've got a situation which I want to fetch data from a database, and
I'm building an asp.net MVC 2 app. I have a list view which lists
I'm looking at the Notes app example from the Android SDK. What I want
Possible Duplicate: nullPointerException in multi column list I have following app which fetches data
i'm branding an iphone app and the designer wants to display list items using
Hi, i have been having some problems using JSON data in flash builder lately
I am developing an app with a master-detail interface which displays a list of
I am developing an asp.net MVC web app in which I am using Linq
I'm writing an iPhone app. Starting from a view controller in a navigation stack
I am writing an app using the MVVM (Model-View-ViewModel) pattern and am leveraging 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.