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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:37:43+00:00 2026-05-23T09:37:43+00:00

If I use create a ListView/ListAdapter and make use of convertView in the adapter’s

  • 0

If I use create a ListView/ListAdapter and make use of convertView in the adapter’s overridden getView() method, how are the properties of each list item view handled? Here’s some code to better illustrate:

List Item

protected void onFinishInflate() {
    super.onFinishInflate();
    checkbox = (CheckedTextView)findViewById(android.R.id.text1);   
    description = (TextView)findViewById(R.id.description);
}

public void setTask(Task t) {
    task = t;
    checkbox.setText(t.getName());
    checkbox.setChecked(t.isComplete());
    if (t.getDescription().length() <= 0)
        description.setVisibility(GONE);
    else
        description.setText(t.getDescription());
}

List Adapter

public View getView(int position, View convertView, ViewGroup parent) {

    TaskListItem tli;
    if (convertView == null)
        tli = (TaskListItem)View.inflate(context, R.layout.task_list_item, null);
    else
        tli = (TaskListItem)convertView;

    tli.setTask(currentTasks.get(position));
    return tli; 
}

Whenever the list view gets refreshed (after it’s initial appearance), every list item’s TextView’s visibility property gets set to “GONE.” It took me a while to realize that the property was carrying over every time the view came from convertView. Explicitly setting the visibility property in both conditions solves the problem. Like so:

public void setTask(Task t) {
    task = t;

    checkbox.setText(task.getName());
    checkbox.setChecked(task.isComplete());
    if (task.getDescription().equals("")) 
        description.setVisibility(GONE);
    else
        description.setVisibility(VISIBLE);
        description.setText(task.getDescription());
}

Is that because the recycled list item views don’t get “reset” at all since they aren’t being re-inflated? I feel like I understand this concept, but my grasp on it isn’t as firm as I would like.

  • 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-23T09:37:44+00:00Added an answer on May 23, 2026 at 9:37 am

    Is that because the recycled list item views don’t get “reset” at all since they aren’t being re-inflated?

    Correct. Recycled really does mean “recycled” — it is a row that had been on the screen, that you had configured for some other adapter position, and is now available for reuse. That row is however you left it, so you need to completely set it up, including possibly undoing things you had done to the row previously.

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

Sidebar

Related Questions

i want to create horizontal list with these uielements in wpf.I already use listview
I will use quickaction for a listview. I use this example for quickaction: http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
What algorithm would you use to create an application that given appropriate data (list
This is a design question: when do I need to create/use a static method
I need to create a very small ListView. Each row could have a different
I want to know about basics to create ListView. How many methods to use
I am trying to create an expandable listview similar to the expandable list shown
I want to create a single choice listview in which when an item is
I have a listview which has an extra property which I use to create
I want to create a listview where each element has several imageview, but they

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.