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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:04:19+00:00 2026-06-16T13:04:19+00:00

I have a class for the row, it extends RelativeLayout and inflates some layout

  • 0

I have a class for the row, it extends RelativeLayout and inflates some layout to self. A CheckBox checked state listener is also set.

public class LayersListRow extends RelativeLayout {         

  public LayersListRow (Context context, final GITuple tuple) {
    super(context);
    LayoutInflater.from(context).inflate(R.layout.layers_list_item, this, true);
        ...

    CheckBox checkbox = (CheckBox)findViewById(R.id.layers_list_item_switch);

    checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged (CompoundButton buttonView, boolean isChecked) {
        ...
        }
    });
  }
    ...
}

I have a custom ArrayAdapter, which is filled with some objects of this class. I want to use them as the view too.

public class LayersAdapter extends ArrayAdapter<LayersListRow> {

    @Override
    public View getView (int position, View convertView, ViewGroup parent) {
        return getItem(position);
    }

    public LayersAdapter (Context context, int resource, int textViewResourceId) {
        super(context, resource, textViewResourceId);
    }
}

But when I set this adapter to my ListView the CheckBox‘s listener doesn’t work. But for the items which appears on scroll down, it works fine.

If I replace return getItem(position); in the getView method with

if (null == convertView)
  return getItem(position);

return convertedView;

then for all items visible at first in the list listener works great, but when I try to scroll I get wrong item (the first one again), ListView freezes and don’t respond.

Why is this happening and how should I make it work properly?

  • 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-16T13:04:21+00:00Added an answer on June 16, 2026 at 1:04 pm

    When you use this

    if (null == convertView)
      return getItem(position);
    
    return convertedView;
    

    The view are reused. Hence when you scroll the views that where first shown will again be shown.

    I would recommend you to see the answer I have written in this post. If you cannot follow it put a comment down here.

    Get checked Listitems from ListView and pass that to another activity

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

Sidebar

Related Questions

I have a class that contains this class method: def self.get_event_record(row, participant) event =
I have some AsyncTask class that executing from service: public class DownloadTask extends AsyncTask<Void,
I have: One MyListActivity class extends ListActivity setContentView(R.layout.mylist) ; Two xml files: mylist.xml and
I'm working on an iPhone application. I have an object of class Row that
I have a bunch of links with the class name row. What I'm trying
So I have a class called MatrixMxN, in the constructor it has parameters row,
You have the EntityManager.find(Class entityClass, Object primaryKey) method to find a specific row with
I have a xml that looks like below <xsl:template match=//xml> <xsl:for-each select=//z:row> <ul class
I have class that extend FragmentActivity in it I add fragment to layout as
I have a custom list adapter: class ResultsListAdapter extends ArrayAdapter<RecordItem> { in the overridden

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.