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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:22:04+00:00 2026-05-25T20:22:04+00:00

I am feeding a ListView from a database in this way (nothing special), except

  • 0

I am feeding a ListView from a database in this way (nothing special), except
COL_TXT_TRANSL2 contains html formatting:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle extras = getIntent().getExtras();
    mCurrBookID = extras.getString("BookID");
    mCurrChapterNum = extras.getString("ChapterNum");
    mCurrChapterTitle = extras.getString("ChapterTitle");
    mGitaDB= Central.mDB;

    this.setTitle(mCurrChapterNum+"."+mCurrChapterTitle);
    setContentView(R.layout.chapterdisplay);

    //set chapter intro
    TextView tvIntro=(TextView) findViewById(R.id.textIntro);
    tvIntro.setText(Html.fromHtml(extras.getString("ChapterIntro")));


    try {
        String[] columns = new String[] { mGitaDB.COL_TXT_TEXT_NUM, mGitaDB.COL_TXT_TRANSL2 };
        int[] to = new int[] { R.id.number_entry, R.id.title_entry };

        mCursor=mGitaDB.GetGitaTexts(mCurrBookID, mCurrChapterNum);
        mAdapter = new SimpleCursorAdapter(this,
                R.layout.textslist_row, mCursor, columns, to);

        setListAdapter(mAdapter);
    }
    catch (Exception e) {
         String err="Error: " + e.getMessage();
         Toast toast = Toast.makeText(Central.context, err, 15000);

         toast.show();
    }

}

Now the problem is that the text displayed in this ListView has HTML formatting.

How can I make listview display this HTML formatting? Currently it is displayed as a plain text with all tags.

  • 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-25T20:22:05+00:00Added an answer on May 25, 2026 at 8:22 pm

    Assuming the HTML is fairly simple you can run it through this method: http://developer.android.com/reference/android/text/Html.html#fromHtml(java.lang.String) The resulting Spannable can be sent to a TextView in the ListView. Beware the fromHtml method is very slow and may slow down scrolling, you might want to cache the Spannables.

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

Sidebar

Related Questions

I came accross this on the Mike Ash Care and feeding of singletons and
I got this bad feeling about how I insert larger amounts of HTML. Lets
So I am feeding the results of this SQL into an array. The array
I'm reading raw data from a mic and feeding into FFT. Two of the
Immutable objects are great because they require no special care or feeding in multi-threaded
I set the min height of a datagrid that way: <DataGrid MinRowHeight=40> After feeding
Is this possible in TSQL? I am feeding this structure in via an xml
I am feeding the label to my LinkButton directly from a string I receive
I am dynamically generating HTML and feeding it into a UIWebView. I have a
I see two ways of going about feeding data to and from a mobile

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.