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

  • Home
  • SEARCH
  • 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 3396378
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:24:02+00:00 2026-05-18T04:24:02+00:00

How will i go about saving the state of a listview item during scrolling,

  • 0

How will i go about saving the state of a listview item during scrolling, so that the recycler does not use it when displaying the next row being. i basically have a listview with 4 textviews and one of the textview is displayed based on a condition, derived from a database. For clarity sake, i will call that dependant textview “A”.

my problem is that, simplest case: if “A” is being displayed for only the first item or any other row in the list and its not displayed anywhere else, when scrolling, “A” is displayed on other rows that should not have it. i understand the concept of listview reusing rows, but i can’t figure out how to save it on an item, so it doesn’t get used in another row. Here is a simplified code with just 2 textview:

  holder.viewItemName = (TextView)view.findViewById(R.id.nameId);
  holder.viewdescriptionStatus = (TextView)view.findViewById(R.id.viewdescriptionId);

    int namecolumn = c.getColumnIndex(DBAdapter.NAME); 
    String name = c.getString(namecolumn);

    holder.viewItemName.setText(name);

    int description = c.getColumnIndex(DBAdapter.description);
    String descriptionstatus = c.getString(description);


    /*problem am having here*/
    if(description != null){
    holder.viewdescriptionStatus.setText("description available");
        holder.viewdescriptionStatus.setTextColor(Color.BLUE);
    }

as you can see, am using a viewHolder, but i have come to realise that viewHolder doesn’t hold the logic as well. i don’t know how to save the state of the holder.viewdescriptionStatus based on that condition. Most of the examples i have seen are based on checkboxes. Please anyone with ideas?.. it will be really appreciated.

P.S : i am using bindView() and newView() since i am using an SQLdatabase and SimpleCursorAdapter. i have the same issue with clicking, but i want to solve the scrolling part first. Thank you for your time.

  • 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-18T04:24:03+00:00Added an answer on May 18, 2026 at 4:24 am

    Try this

    holder.viewdescriptionStatus.setText(description != null ? "description available" : "");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are building a REST service that will take about 5 minutes to execute.
I have a C++ program which, during execution, will allocate about 3-8Gb of memory
I have very recently started development on a multiplayer browser game that will use
During a recent peer review, another Software Engineer suggested that I state that the
I am going to program a GUI under windows (will be about 10,000 line
On a site I'm working on there will be about 7 different directories. I
I have to build a html website, which will contain about 50+ pages. The
I have problem adding arraylist to list view, will explain about my problem here..
How will I go about this? I can show you some of my code.
In an application I will have between about 3000 and 30000 strings. After creation

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.