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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:07:27+00:00 2026-05-26T16:07:27+00:00

I’m developing for Android and I have an app (called Forget-Me-Not) that uses a

  • 0

I’m developing for Android and I have an app (called Forget-Me-Not) that uses a ListView as the Tasks screen (Its a ToDo list app). And I have set the items to be grayed out when they are completed.

When the list is bigger than the screen, scrolling occur as usual. But the problem is when scrolled upwards/downwards and come back again, the uncompleted items too have been grayed out. I have checked this many times and the graying-out seems to be random. The items are clickable and they are functioning as expected (i.e. long-clicking, etc). The only problem is the graying-out. (This confuses the users as this app is ToDo list managing app and graying-out is “completing” a task).

I don’t know what code to post, so if anyone can tell me what code I should post or could give an answer straightaway, I would be really thankful.

PS: I’ve got a custom ListAdapter class. It mainly reads the items from SQLite database and sets them to the adapter. You can see the bug in my app- its in the Android Market (Forget-Me-Not).

EDIT:
Here is my custom TaskAdapter class:

public class TasksAdapter extends BaseAdapter {

private String[] items;
private int[] priorities;
private Vector<String> completed;
private Context context;

public TasksAdapter(TasksActivity context, int textViewResourceId, String[] items) {
    if(items != null)
        this.items = items;
    else
        this.items = new String[0];

    this.priorities = new int[this.items.length];
    for(int i = 0; i < this.priorities.length; i++) {
        this.priorities[i] = FMN.PRIORITY_LOW;
    }

    this.completed = new Vector<String>(0);

    this.context = context;
}

public TasksAdapter(TasksActivity context, int textViewResourceId, String[] items, int[] priorities, Vector<String> completed) {
    if(items != null)
        this.items = items;
    else
        this.items = new String[0];

    if(priorities != null)
        this.priorities = priorities;
    else {
        this.priorities = new int[this.items.length];
        for(int i = 0; i < this.priorities.length; i++) {
            this.priorities[i] = FMN.PRIORITY_LOW;
        }
    }

    if(completed != null)
        this.completed = completed;
    else
        this.completed = new Vector<String>(0);

    this.context = context;
}

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

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

    TextView task = (TextView) v.findViewById(R.id.tv_task);
    task.setText(items[position]);

    ImageView prio = (ImageView) v.findViewById(R.id.im_task_priority);

    switch(priorities[position]) {
    case FMN.PRIORITY_HIGH:
        prio.setImageResource(R.drawable.fmn_priority_high);
        break;

    case FMN.PRIORITY_MEDIUM:
        prio.setImageResource(R.drawable.fmn_priority_low);
        break;

    case FMN.PRIORITY_LOW:
        prio.setImageResource(R.drawable.fmn_priority_medium);
        break;

    default:
        prio.setImageResource(R.drawable.fmn_priority_medium);
        break;
    }

    if((completed.size() != 0) && (completed.contains(task.getText()))) {
        task.setTextColor(Color.rgb(155, 175, 155));
    }

    return v;
}

public int getCount() {
    return items.length;
}

public Object getItem(int position) {
    return position;
}

public long getItemId(int position) {
    return position;
}

}

And a screenshot BEFORE scrolling:

Before Scrolling

And AFTER scrolling:
After Scrolling

  • 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-26T16:07:28+00:00Added an answer on May 26, 2026 at 4:07 pm

    It is probably a bug in your ListAdapter getView. Do you recycle your list objects/items? The properties for colors and so on will remain on the object when recycled. Make sure you set the properties correct depending on in which state the task is in.

    In the getView function you probably check if the view-item allready is set and then you just change the text for the task on the item (recycling)? At the same place in the code change the color settings for background to the correct task state.

    EDIT
    Now that I see your code it looks like you have got the priorities mixed up, default and priority low set the background to prio.setImageResource(R.drawable.fmn_priority_medium);
    and medium sets the background to prio.setImageResource(R.drawable.fmn_priority_low);

    Ok I found the problem:

    if((completed.size() != 0) && (completed.contains(task.getText()))) {
        task.setTextColor(Color.rgb(155, 175, 155));
    }
    

    You need an else statement here to set the text color to the original color if it is not completed. Like:

    if((completed.size() != 0) && (completed.contains(task.getText()))) {
        task.setTextColor(Color.rgb(155, 175, 155));
    } else {
        task.setTextColor(Color.rgb(0, 0, 0));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a bunch of posts stored in text files formatted in yaml/textile (from
We're building an app, our first using Rails 3, and we're having to build

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.