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

  • Home
  • SEARCH
  • 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 two listviews, clicking an item on the first list view loads the
Not sure how to expand on the title. If I have two ListViews in
I am trying to show two custom listviews on one activity. But I am
I have a listview with two columns and I'm using a context menu to
I have two applications written in Java that communicate with each other using XML
I have two arrays of animals (for example). $array = array( array( 'id' =>
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two elements: <input a> <input b onclick=...> When b is clicked, I
I have two identical tables and need to copy rows from table to another.
I have two classes, and want to include a static instance of one class

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.