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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:24:39+00:00 2026-05-23T01:24:39+00:00

I made a listview that has three textviews and a checkbox and put it

  • 0

I made a listview that has three textviews and a checkbox and put it into a BaseAdapter. What it has to do is if an item is at the ‘unread‘ status, then make its textviews BOLD. However, I encountered two problems.

  1. the top item is always BOLD no matter it is read or unread.
  2. If I do scrolling, then items reloaded by scrolling start to be bold

I researched about it but couldn’t find any good things for me. If anyone has an idea, would you please help me? Below is getView().


public View getView(final int position, View convertView, ViewGroup parent) {
            View view = convertView;
            ViewHolder viewHolder;

            if(convertView == null){ // check if convertView exists
                // get and inflate layout
                view = layoutInflater.inflate(R.layout.row, null);

                viewHolder = new ViewHolder();
                viewHolder.tv1 = (TextView)view.findViewById(R.id.list_callerIDname);
                viewHolder.tv2 = (TextView)view.findViewById(R.id.list_callerIDnumber);
                viewHolder.tv3 = (TextView)view.findViewById(R.id.list_messageSentTime);
                viewHolder.cb = (CheckBox)view.findViewById(R.id.checkBox1);

                // get each CheckBox into cb_array for future use
                this.cb_array[position] = (CheckBox)view.findViewById(R.id.checkBox1);

                // use it as a tag
                view.setTag(viewHolder);
            }
            else{
                viewHolder = (ViewHolder)view.getTag();
            }

            viewHolder.tv1.setText(this.callerIDnames[position]);
            viewHolder.tv2.setText(this.callerIDnumbers[position]);
            viewHolder.tv3.setText(this.messageSentTimes[position]);

            // if message is unread, then make texts bold
            if (messageRead_list[position] == false){
                viewHolder.tv1.setTypeface(viewHolder.tv1.getTypeface(), Typeface.BOLD);
                viewHolder.tv2.setTypeface(viewHolder.tv2.getTypeface(), Typeface.BOLD);
                viewHolder.tv3.setTypeface(viewHolder.tv3.getTypeface(), Typeface.BOLD);
            }

            return view;
        }
  • 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-23T01:24:40+00:00Added an answer on May 23, 2026 at 1:24 am

    You will have to pass null in setTypeFace() instead of using getTypeFace().

    When getTypeFace() doesn’t return null the style wont be set correctly.

    // if message is unread, then make texts bold
    if (messageRead_list[position] == false){
        viewHolder.tv1.setTypeface(null, Typeface.BOLD);
        viewHolder.tv2.setTypeface(null, Typeface.BOLD);
        viewHolder.tv3.setTypeface(null, Typeface.BOLD);
    } else {
        viewHolder.tv1.setTypeface(null, Typeface.NORMAL);
        viewHolder.tv2.setTypeface(null, Typeface.NORMAL);
        viewHolder.tv3.setTypeface(null, Typeface.NORMAL);
    }
    

    Or you could use this directly which is what’s done when you pass null.

    setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
    

    and

    setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've made a search screen that has one tab for keywords, filters, and a
I've made a ListView in my project, but I find that when I drag
I've made a custom control, it's a FlowLayoutPanel, into which I put a bunch
I have made a ListView in my android application. But the problem is that
I have a shopping cart ListView control backed by a custom object that has
I'm creating a WPF application where several ListView selections are made in a row
I made a class that derives from Component: public class MyComponent: System.ComponentModel.Component { }
I made a code that translate strings to match each word from the array
I made an html file called test.html then I navigated to it as http://site.com/test.html?test1=a
I have a ListView in which i have a function that creates images for

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.