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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:20:12+00:00 2026-05-24T20:20:12+00:00

i´m in trouble with a custom Listview and (Checkboxes or Button). I follow a

  • 0

i´m in trouble with a custom Listview and (Checkboxes or Button). I follow a guide (the android devolopers´s cookbook) and my custom Listview show correctly. An visisble Error occured when selected Checkboxes are scrolling.(Wrong Checkboexes are checked)

I followed the guide on
http://www.vogella.de/articles/AndroidListView/article.html#listviews_performance
but it doesn´t work. How to save the state correctly?

Greeting
Andreas

  • 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-24T20:20:13+00:00Added an answer on May 24, 2026 at 8:20 pm

    You will have to save the checked items in a list variable (in your Adapter subclass) and set the correct state (checked/unchecked) depending upon whether the item is present in the list variable.

    private List<MyItem> mCheckedItems; //In your adapter subclass
    

    Add/remove an item from the list variable:

    //The AdapterView.OnItemClickListener, is present where you set myListView.setOnItemClickListener(this);
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long id)
    {
    
        MyItem item = myAdapter.getItem(position);
        myAdapter.updateCheckedItems(item);
    }
    
    public void updateCheckedItems(MyItem item) //In your adapter subclass
    {
            if(!mCheckedItems.contains(item))
            {
                mCheckedItems.add(item);
            }
            else
            {
                mCheckedItems.remove(item);
            }
    }
    

    Set the correct state of the checkbox:

    public View getView(int position , View view , ViewGroup parent) //In your adapter subclass
    {
         final MyItem item = getItem(position);
         CheckBox checkBox = (CheckBox)view.findViewById(R.id.checkBox);
         checkBox.setChecked(mCheckedItems.contains(item));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have trouble getting a custom ObjectDataSource for an asp:ListView control to work. I
I have an Android project that loads a custom .so lib. I'm having trouble
I'm having trouble getting chrome to display my custom cursor correctly but it seems
I am having trouble getting a custom message while still getting the error classes
I'm having trouble creating a custom close button for my overlay. Here's what the
I'm having trouble associating my custom file extension to my android application that I
I'm having trouble with disabling button with custom template and a click listener. Here's
I'm developing a custom trouble ticket system for network management and trying to find
I'm having trouble with a custom tag:- org.apache.jasper.JasperException: /custom_tags.jsp(1,0) Unable to find setter method
I am having trouble animating a custom UITableView section header. The goal was 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.