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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:02:44+00:00 2026-06-15T05:02:44+00:00

I am new to Android. I have some Products like a0, a1, a2. I

  • 0

I am new to Android. I have some Products like a0, a1, a2. I want to add their definitions in the second line as x0, x1, x2.

Here is my main code:

private ListView lv;
ArrayAdapter<String> adapter;
ArrayList<HashMap<String, String>> productList;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_eagle);

 String products[] = {"a0", "a1","a2", };
 String definitions[] = {"x0", "x1","x2",};

lv = (ListView) findViewById(R.id.list_view);
    inputSearch = (EditText) findViewById(R.id.inputSearch);

    // Adding items to listview
    adapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.product_name, products);
    lv.setAdapter(adapter);

What I find:

a0


a1


a2


How can I find them in this way:


a0

x0


a1

x1


a2

x2


Thanks in advance.

  • 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-15T05:02:45+00:00Added an answer on June 15, 2026 at 5:02 am

    You need to change your adapter to something like this:

    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_2, products){
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if(convertView == null)
                 convertView = View.inflate(getBaseContext(), android.R.layout.simple_list_item_2, null);
    
            ((TextView) convertView.findViewById(android.R.id.text1)).setText(products[position]);
            ((TextView) convertView.findViewById(android.R.id.text2)).setText(definitions[position]);
    
            return convertView;
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to Android, I have some code when the user changes a preference I
I am a bit new with android but I have some java experience. So
I am new in Android. I have develop an app. And now want to
I'm pretty new to Android but I have some experience (and a bit rusty
I have some questions about android ui api. Give a example, that I want
I'm brand new to Android dev and have some n00b questions about AVD. Is
I am new to the android api and I have some problems with ..
i am new to android i have to perform some operation after every 30
I'm new to Android programming however I do have some Java experience. What I
I'm new to Android development and have some question regarding overlays in googlemaps API.

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.