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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:53:15+00:00 2026-06-10T05:53:15+00:00

I have created a ListView with Arraylist as below: nAdapter=new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_checked,nArrayList); mListView.setAdapter(nAdapter); then

  • 0

I have created a ListView with Arraylist as below:

nAdapter=new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_checked,nArrayList);

mListView.setAdapter(nAdapter);

then the setOnItemClickListener():

mListView.setOnItemClickListener(new OnItemClickListener(){

    public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
       if(((CheckedTextView) arg1).isChecked()){
            ((CheckedTextView)arg1).setChecked(false);
       }else{
        ((CheckedTextView)arg1).setChecked(true);
       }
}});

The problem is if I select an item, every 7 or 8 item (the first item not in the current view, but viewed when scrolled up) further down on the list also get selected. This happens though out the list.

Can someone explain what is happening here ?

  • 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-06-10T05:53:17+00:00Added an answer on June 10, 2026 at 5:53 am

    To solve this, simply use:

    mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    

    and remove your OnItemClickListener.


    Android employs View recycling. Imagine a ListView with 1,000 rows: it is wasteful to have a unique View for each row when the user can only see a handful at a time. So the adapter wisely only creates enough unique Views that are visible (about 7 or 8 in your case) and recycles these unique Views to show all 1,000 rows; creating a faster app.

    The errant checkmarks that you are seeing in your rows happens when the “previous” row was checked but not cleared after the row is recycled and filled with the “new” data.

    Hope that makes sense otherwise please watch Android’s Romain Guy discuss this phenomena here.

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

Sidebar

Related Questions

I have created an ArrayList<HashMap<String, String>> collection to hold my data for ListView .
I have an Android app with a ListView. I've created my own item layout
I have created a listview with 3 rows in Android. If I would like
I have created an xml file like this: <?xml version=1.0 encoding=utf-8?> <ListView xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent
I created a ListView with a custom layout for each view. I have several
ArrayList<MyClass> myList = new ArrayList<MyClass>(); ListView listView = (ListView) findViewById(R.id.list); ArrayAdapter<MyClass> adapter = new
I have created a custom listView with the row as follows: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent
I have created a listview using following tutorial link http://www.ezzylearning.com/tutorial.aspx?tid=1763429 Outcome of this is,
I have created a TableLayout with a listView in it. I define the listView's
HI Guyz i have created a sectioned custom listview using baseadapter its working fine

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.