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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:15:19+00:00 2026-05-26T04:15:19+00:00

@Override public View getView(final int position, View convertView, ViewGroup parent) { View v =

  • 0
@Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        View v = convertView;

        if(v == null){
            LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.country_row, null);
        }

        Country item = getItem(position);

        TextView tv1 = (TextView) v.findViewById(R.id.country);
        final CheckedTextView ctv = (CheckedTextView) v.findViewById(R.id.checked);
        ctv.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ctv.toggle();
                Country country = (Country) listView.getItemAtPosition(position);
                Log.d("daim", country.getCountry() + " " + country.getCode());
                //listView.getCheckItemIds();
            }
        });

        tv1.setText(item.getCountry());

        return v;
    }

When I check let’s say first element (position 0), it gets checked, but when I scroll down the listview, the first position of next “section” gets also checked, this continues all the way down. For instance, I have 100 elements, and I check position 0, then position 10, 20, 30, 40 etc gets also checked. How can handle this kind of problem?

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-26T04:15:20+00:00Added an answer on May 26, 2026 at 4:15 am

    that’s because the listview recycle its view, so it keeps a pool of view that reuse. THe pattern typically I use is:

    if (this row need to be checked)
            check it
    else
            force uncked it
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing the following class RuleObject implements Comparable{ @Override public String toString() {
colLabels[i].addMouseListener(new MyAdapter()); private class MyAdapter extends MouseAdapter { @Override public void mouseClicked(MouseEvent event) {
Basically, I have the following so far: class Foo { public override bool Equals(object
According to http://www.codeguru.com/forum/showthread.php?t=463663 , C#'s getHashCode function in 3.5 is implemented as: public override
I'm using the following mapping: public class LoadMap : IAutoMappingOverride<Load> { public void Override(AutoMapping<Load>
package { import mx.controls.LinkButton; import flash.text.TextLineMetrics; public class multiLineLinkButton extends LinkButton { override protected
My Program overrides public void paint(Graphics g, int x, int y); in order to
I override ProcessCmdKey() in my MDI parent form class and have some keyboard shortcut
So I'm just trying to currently inflate a view in my getView function and
I have used BaseAdapter for grid view, in getView method of BaseAdapter I am

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.