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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:40:58+00:00 2026-05-25T09:40:58+00:00

Currently I have a ListView with a TextView within each child. That TextView is

  • 0

Currently I have a ListView with a TextView within each child. That TextView is taking in a Spanned string to populate it. I am using the ViewHolder pattern and I am not parsing the Spanned string in getView(). When I switch from a Spanned string back to just a plain string the performance of the ListView’s scrolling increases dramatically. I would like to keep using Spanned because it will format my text correctly on the fly.

Is their a way to increase the performance of my ListView while keeping the string input for my TextViews Spanned?

@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
    final ViewHolder holder;

    if (convertView == null) {
        convertView = inflater.inflate(R.layout.comment, null);

        holder = new ViewHolder();
        holder.userName = (TextView) convertView.findViewById(R.id.comment_user_name);
        holder.date = (TextView) convertView.findViewById(R.id.comment_created_date);
        holder.body = (TextView) convertView.findViewById(R.id.comment_body);

        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    User user = array.get(position).getCreatedBy();
    holder.userName.setText(user.getName());
    holder.date.setText(array.get(position).getDateCreated());
    holder.body.setText(array.get(position).getBody());

    return convertView;
}
  • 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-25T09:40:58+00:00Added an answer on May 25, 2026 at 9:40 am

    Although I did not find out the cause of the problem I did find a workaround to fix the problem noted above.

    The call getBody() was returning a Spanned object which was causing an unusual amount of garbage collection with each iteration of getView(). When I converted the Spanned to a String the problem goes away. This is the code I modified to fix the problem.

    holder.body.setText(array.get(position).getBody()**.toString()**);
    

    Although I would still like to find a solid reason as to why this does occur.

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

Sidebar

Related Questions

I currently have a ListView and each element of that list consists of at
Currently I have a ListView (using the Details View). I would like to implement
I have learned that when using android:entries with a ListView , it uses android.R.layout.simple_list_item_1
I currently have a custom listview with two rows of text in each item,
I have a ListView that's populated from a SimpleCursorAdapter each row containing 3 different
I have a listview with a textview as each item. I want to change
I currently have a ListView with a custom adapter that gets information describing the
I currently have a listview showing a couple of string arrays. I was wondering
I have a Listview that looks like the following: checkbox:textview {0 .. n} I
I currently have a ListView that takes in an array of strings. It is

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.