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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:56:31+00:00 2026-05-26T14:56:31+00:00

Hello i’m working on an app where i’m basically just making a custom multi

  • 0

Hello i’m working on an app where i’m basically just making a custom multi select listview i did something like this LeftAL is just an array list and this code below is in my onClick

if(LeftAL.contains(position)){
   ImageView imageView = (ImageView) lView.getChildAt(position).findViewById(R.id.checkbox);
   imageView.setImageResource(R.drawable.checkboxoff);
   int i = position;
   Integer intObj = new Integer(i);
   LeftAL.remove(intObj);
}else{
   ImageView imageView = (ImageView) lView.getChildAt(position).findViewById(R.id.checkbox);
   imageView.setImageResource(R.drawable.checkbox);
   LeftAL.add(position);
}

and then checkboxoff looks like this

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"    
    android:drawable="@drawable/checkbox_pressed_off" />
<item android:drawable="@drawable/checkbox_off" />
</selector>

and checkbox on is the same thing basically just different images

Now that all works fine as it should and i didn’t actually notice this for a little while but when i check say item 3 in my list. It checks and adds to the array list as it should however if i scroll down to the next group of list items i will see that number 3 of the second set is also checked for instance lets just say for example only 3 rows show on my phone.

Cat
Dog
Egg
-------off screen-----
Fox
Gerbil
Hog

I check Dog then i scroll gerbil would also be checked i guess this is just android like recycling or something but it’s definately an issue how can i fix this so that only 3 in the list checks not 3 in the next set as well.

Thank you for any help

  • 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-26T14:56:32+00:00Added an answer on May 26, 2026 at 2:56 pm

    Android absolutely recycles the Views in a ListView. What you need to do is ensure that you are storing the checked / unchecked state in a separate list and set the state of the check box accordingly each time it’s shown.

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

Sidebar

Related Questions

hello i got a batch file, something like this: if %day%==monday, tuesday, wednesday, thursday,
Hello I am working with a simulator that uses rcS scripts to boot, this
Hello fellow developers... just to make sure, I want to ask this question: How
Hello can anybody solve this please I'm creating the object in the action class
Hello , I am currently working on the student association's website. The student's association
Hello I am working with the Kate editor based on the lack of other
Hello Guys I am trying to figure out why i am gettings this error
hello creating a custom object may be a widely published topic, but my lack
Hello,I'd like to ask you two questions. (I am using java and jedis) I
Hello, Im working on a solution for Android that will record calls (both out

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.