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

The Archive Base Latest Questions

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

I have two listviews in the same activity. They both trigger this: public void

  • 0

I have two listviews in the same activity. They both trigger this:

public void onItemClick(AdapterView adapter, View v, int position, long arg3) 

How do I check which list was selected from this event handler?
Also, if adapter == listA then I need the checkbox in that list and position to be selected/unselected. How do I do this from within my activity here?

Maybe something like: v.myCheckBox.setChecked(false) <– obviously that doesn’t work.

Note: I am using two custom adapters that inherit from base adapter.

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

    For getting the checkbox – it’s best to use something like that:

    checkbox = (Checkbox) view.findViewById(R.id.yourcheckboxid);
    checkbox.setChecked(false);
    

    The easiest way to know who created a view is to store some kind of identifier in Tag field of the view created by the adapter (View.setTag() method). This should be set when the new view is created in getView method of the adapter . Then from view.getTag() you will be able to see which adapter created it and react appropriately.

    Although from what you write you should do it differently (if you inherit adapter anyway). If your adapter hierarchy is:

    A -> B1
      \
       B2
    

    And you have checkboxes only in views created in B1, then you should get something like that in B1:

    @Override
    public void onItemClick(AdapterView adapter, View v, int position, long arg3) {
       super.onItemClick(adapter,v,position,arg3);
       checkbox = (Checkbox) view.findViewById(R.id.yourcheckboxid);
       checkbox.setChecked(false);
       ... any other custom handling for list handled by B1
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JQM page with two data-role=listview . They both share the same
i need to implement this layout in android..the view must be have two list
I have two ListViews (A and B) with items of the same type (a
I have two listviews, clicking an item on the first list view loads the
Is there a way to have two ListViews on the same form and highlight
I have a RelativeLayout with different elements. I was planning to have two ListViews
I have a page with two Listviews (with two different data sources). I have
I have a tab contol with two tabs. Each one containing listviews. When the
I have an Activity in Android, with two elements: EditText ListView When my Activity
I'm trying to use two listviews (that are on same page - wpf) to

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.