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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:28:24+00:00 2026-05-13T11:28:24+00:00

I need your help. I’m really new to Android, developing in Eclipse with the

  • 0

I need your help. I’m really new to Android, developing in Eclipse with the latest 2.1 SDK.

This is really simple. I make a ListView which is filled with Checkbox widgets.

My code:

public class HelloAndroid extends Activity {

    static final String[] COUNTRIES = new String[] {
        "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
        "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
        "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
        "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium"}; 

    protected ListView myList;

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

        myList = (ListView)findViewById(R.id.myList);
        ArrayAdapter<String> myAdapter = new ArrayAdapter<String>(this, R.layout.row, R.id.myBox, COUNTRIES); 
        myList.setAdapter(myAdapter);
    }
}

And this is the Layout-XML-file (row.xml), consisting of a single checkbox:

<?xml version="1.0" encoding="utf-8"?>
<CheckBox
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/myBox"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"/>

Now if there are enough strings in the COUNTRIES-Array and you can scroll the List, you will see, that if you check one CheckBox and scroll down, some another CheckBox gets checked automatically. And if you check some more boxes, more get checked automatically, or ones that were checked get unchecked.

I’ve also tried android:focusable="false" for the CheckBox (in the XML), as well as android:focusableInTouchMode, as described in some similar threads, but nothing seems to help…

Looks like its a bug??

  • 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-13T11:28:24+00:00Added an answer on May 13, 2026 at 11:28 am

    What’s happening is that Android is reusing the CheckBox views it creates to display the list to save memory. Instead of creating a new CheckBox for every item in your list, Android creates just enough to fill the screen, updating them to show the relevant data for the items which are currently visible.

    If you have no link between the data in your Adapter and the state of the CheckBox in the view then it will appear that lots of CheckBoxes are linked, when in fact it’s the same CheckBox with a different label.

    Have you set the choiceMode attribute of your ListView? If you do, this will tell the ListView to keep track of what you have selected.

    Also, consider using the CheckedTextView class instead of CheckBox.

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

Sidebar

Ask A Question

Stats

  • Questions 273k
  • Answers 273k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You have said "MyTests does not run the tests in… May 13, 2026 at 2:06 pm
  • Editorial Team
    Editorial Team added an answer Your problem is that the table doesn't know it needs… May 13, 2026 at 2:06 pm
  • Editorial Team
    Editorial Team added an answer You will have to use IIS on your development machine.… May 13, 2026 at 2:06 pm

Related Questions

I need your help in this case: I have: 1 11 111 Cat1 a,b,c
I need your help, For example I have a decimal type variable and I
I need your help with the following scenario: I am reading some data from
I need your help to define a special case in XML schema: A sequence
Hi I need your help if you are an expert in MOSS. I have

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.