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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:44:07+00:00 2026-05-25T09:44:07+00:00

I am trying to show two custom listviews on one activity. But I am

  • 0

I am trying to show two custom listviews on one activity. But I am confused how to handle onListItemClick and most important how I can set the ID

@id/android:list

for both the lists on the same activity?

If any one have tried with two list views on single activity, any link, sample code will be helpful. 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-05-25T09:44:08+00:00Added an answer on May 25, 2026 at 9:44 am

    Just define two ListViews in your XML, like:

    <LinearLayout android:orientation="horizontal"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent">
    
        <ListView android:id="@+id/list1"
            android:layout_width="0dp"
            android:layout_weight="0.5"
            android:layout_height="fill_parent" />
    
        <ListView android:id="@+id/list2"
            android:layout_width="0dp"
            android:layout_weight="0.5"
            android:layout_height="fill_parent" />
    
    </LinearLayout>
    

    In your code use this command to assign your Lists

    ListView list1 = (ListView) findViewById(R.id.list1);
    ListView list2 = (ListView) findViewById(R.id.list2);
    

    and for both of them set a different onItemClickListener, for example this way:

        list1.setOnItemClickListener(new OnItemClickListener() {
    
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                //...
    
            }
        });
    

    and you are done 🙂 This way, your activity don’t need to extend ListActivity, just Activity.

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

Sidebar

Related Questions

I'm trying to show two different animations. It works fine with the first one.
Hi i am trying to show two item in list view.i know we can
I am trying to show correlation between two individual lists. Before installing Numpy, I
I'm trying to make a code that will show two different images depending on
I am trying to show an alert with two edittext fields in Android. The
I have two custom entites, Product and ProductType, linked together in many-to-one relationship. Product
I am trying to show two images on Map on base of Points name.
in my app I am facing following two problems I am trying to show
I'm trying to create a custom LinearLayout (on Android), but I keep getting compiler
I have two date columns, domain_renew_date and hosting_renew_date . I am trying to show

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.