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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:42:53+00:00 2026-05-26T03:42:53+00:00

I created a ListActivity extending an arrayAdapter; every element of the list is made

  • 0

I created a ListActivity extending an arrayAdapter; every element of the list is made up by 2 labels and 1 checkbox. It works perfectly fine, except when I uncheck one of those listbox and I scroll up or down, making this check unavailable; problem is that when I get back the previously uncheked checkbox it is checked…what’s wrong with my listActivity? This is the ArrayAdapter-based class:

private class DescrAdapter extends ArrayAdapter<StatDescriptor>{
    private LayoutInflater  inflater;
    private final StatDescriptor[] descriptions;
    private int layoutId;


    public DescrAdapter(Context context, int res,StatDescriptor[] objects) {
        super(context,res , objects);
        this.inflater=LayoutInflater.from(context);
        this.descriptions=objects;
        this.layoutId=res;
    }

    public View getView(final int position, View rowView, ViewGroup parent) {
        rowView = (RelativeLayout) inflater.inflate(layoutId, null);
        TextView textName = (TextView) rowView.findViewById(R.id.StatName);
        textName.setText(descriptions[position].getName());
        TextView textDescr=(TextView) rowView.findViewById(R.id.StatDescr);
        textDescr.setText(descriptions[position].getDescription());
        CheckBox checkEnabled=(CheckBox) rowView.findViewById(R.id.checkStat);
        checkEnabled.setChecked(descriptions[position].isEnabled());
        checkEnabled.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                enabledStats[sortIndexes[position]]=!enabledStats[sortIndexes[position]];
            }
        });
        return rowView;
    }

}

Thank you for your 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-26T03:42:54+00:00Added an answer on May 26, 2026 at 3:42 am

    You use descriptions[position] to set state of check box but you flip enabledStats[sortIndexes[position]]. So next time item view gets recreated with original value that you didn’t change (descriptions[position]).

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

Sidebar

Related Questions

I've created list(containing name,mail,number,date) from server using listview extending by listactivity. And, i've also
I have created a custom ListActivity that shows a list of skills and buttons
i have created a My custom listActivty by extending ListActivity like this. public class
I'm creating a ListActivity. In each list item I have a View I've created
Created .NET WCF service, tested it - works. Generated schemas from Data and service
I created a list of lists: >>> xs = [[1] * 4] * 3
I don't know how to create an custom Activity extending MapActivity and ListActivity ?
I have created a listActivity with my own ListAdapter. The problem is that the
I need to display results from a SQL join in a ListView/ListActivity. I've created
here is my Arrival.java package one.two; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.app.ListActivity;

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.