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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:00:49+00:00 2026-05-24T19:00:49+00:00

I am using my custom adapter. There is a checkbox and a text view

  • 0

I am using my custom adapter. There is a checkbox and a text view in each row.
But i have a problem. There are more items in the list than the number which fits on the screen.

So when i check any of the checkboxes on the screen and scroll down. The automatically get unchecked.

When i scroll up again some random checkboxes get checked.

I know that in getView() list is being refreshed again and again and theres an issue of the position.
But dont know the solution.

I have tried using a boolean array to keep a track. but dnt know how to do it properly.

cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){
                        @Override
                        public void onCheckedChanged(CompoundButton buttonView,
                                boolean isChecked) {

                                itemChecked[index]=isChecked;
                        }
                    });
                    cb.setChecked(itemChecked[index]);

Can you please post some code snippet and explain in detail. i am tired of searching this since last 2weeks… thanks in advance,..

  • 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-24T19:00:50+00:00Added an answer on May 24, 2026 at 7:00 pm
        public View getChildView(final int groupPosition,
                final int childPosition, boolean isLastChild, View convertView,
                ViewGroup parent) {
            final ViewHolder holder;
            //if (convertView == null) {
                holder = new ViewHolder();
                convertView = mInflater.inflate(
                        R.layout.expandableinner_custom_row, null);
    
                holder.textView = (TextView) convertView
                        .findViewById(R.id.textView);
                holder.checkBox = (CheckBox) convertView
                        .findViewById(R.id.checkBox);
                String str = getChild(groupPosition, childPosition).toString();
                holder.textView.setText(str);
                Boolean[] boolArr = SMSActivity.maintaingState.get(String
                        .valueOf(groupPosition));
                Log.i("BOOLARRAYSIZE ", String.valueOf(boolArr.length));
    
                Log.i("Boolean",
                        String.valueOf(boolArr[childPosition] + "GrpPosition: "
                                + groupPosition + "ChildPosition: "
                                + childPosition));
                if (boolArr[childPosition]) {
                    holder.checkBox.setChecked(true);
                } else {
                    holder.checkBox.setChecked(false);
                }
    
                    holder.checkBox
                            .setOnCheckedChangeListener(new OnCheckedChangeListener() {
    
                                @Override
                                public void onCheckedChanged(
                                        CompoundButton buttonView,
                                        boolean isChecked) {
                                    // TODO Auto-generated method stub
    
                                    Boolean[] boolArr = SMSActivity.maintaingState
                                            .get(String.valueOf(groupPosition));
                                    boolArr[childPosition] = isChecked;// (object)
                                    Log.i("grpPosition",
                                            String.valueOf(childPosition));
                                    Log.i("childPosition",
                                            String.valueOf(groupPosition));
                                    SMSActivity.maintaingState.remove(String
                                            .valueOf(groupPosition));
                                    SMSActivity.maintaingState.put(
                                            String.valueOf(groupPosition),
                                            boolArr);
    
                                    Log.i("Boolean", String
                                            .valueOf(boolArr[childPosition]
                                                    + " GrpPosition: "
                                                    + groupPosition
                                                    + "ChildPosition: "
                                                    + childPosition));
    
                                }
                    });
    
                convertView.setTag(holder);
            return convertView;
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used a custom array adapter to populate my list view.The problem i
I have three textviews in a row of a listview using custom adapter and
I have created a custom Base Adapter class, to populate a list view with
I'm using custom renderer on JList, but none of components rendered are accessible. list.setCellRenderer(new
I am using custom row view in ListView widget. I am having getView method
I'm making a custom adapter so that I can display a list of items
I am using a custom List adapter to display a list of all contacts,
I have a grid view which is populated using a custom ImageAdapter class extending
Is there a way to create a search filter over my custom list view
I have a button that should sort a ListView using a custom adapter. The

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.