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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:44:50+00:00 2026-06-13T21:44:50+00:00

I am using custom ListView .Its working fine. I am using this ListView for

  • 0

I am using custom ListView .Its working fine. I am using this ListView for differentiate Read & Unread Messages I pick up message read Id which is 0 for unread message & 1 for read message.
My getView() code is following:—

public View getView(int position, View convertView, ViewGroup parent) 
{
    ViewHolder holder;
    if(convertView==null)
    {
        convertView=mInflater.inflate(R.layout.custom_home_list, null);
        holder=new ViewHolder();
        holder.address=(TextView)convertView.findViewById(R.id.person_name);
        holder.body=(TextView)convertView.findViewById(R.id.full_msg);
        holder.date=(TextView)convertView.findViewById(R.id.msg_time);
        convertView.setTag(holder);
    }else
    {
        holder=(ViewHolder)convertView.getTag();
    }
    int size=mArrList.size();
    if ((mArrList != null) || size > 0) 
    {
        if(mArrList.get(position).read.equalsIgnoreCase("1")){
        holder.address.setText(mArrList.get(position).address);
        holder.body.setText(mArrList.get(position).body);
        holder.date.setText(mArrList.get(position).date);
        }else{
            holder.address.setText(mArrList.get(position).address);
            holder.body.setText(mArrList.get(position).body);
            holder.body.setTextColor(mArrList.get(position).color);
            holder.date.setText(mArrList.get(position).date);
        }
    }
    return convertView;
}

here i use this condition for differentiate :-

 if(mArrList.get(position).read.equalsIgnoreCase("1")){
   }

But Position Repeat After 5 items so my condition not working.
I have lots of search for this But I am not getting it.
Please Help me .
Thanks In Advance!
Regards Deepanker

  • 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-13T21:44:52+00:00Added an answer on June 13, 2026 at 9:44 pm

    In your code you don’t explicitely set the color in case of a ‘read’ state (the first section of your if/else).

    It means that if your view is recycled and it was previously used for an ‘unread’ item, then the color will remain the same.

    You need to explicitely say which color you want in both cases, because you cannot know what the initial color is.

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

Sidebar

Related Questions

HI Guyz i have created a sectioned custom listview using baseadapter its working fine
I'm trying to sort the list items, I'm using custom listview. In this i
I have created a custom ListView with radioButton on each its rows using Custom
I am using custom row view in ListView widget. I am having getView method
I've got a ListView that is populated using a custom BaseAdapter (MyBaseAdapter) : public
I am displaying images and text to a listview using a custom adapter, when
I'm using custom class that subclass from UILabel. It works fine unless I change
I'm using a custom listview I found here: http://developer.android.com/resources/samples/ApiDemos/res/layout/linear_layout_9.html Seems to be valid in
I am working on Custom ListView for an assignment given to me. I have
I am using a ListView with a custom adapter for displaying items as pairs

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.