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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:24:19+00:00 2026-05-29T10:24:19+00:00

This is in relation to a previous question I asked here. Calling replaceAll(\n, <br

  • 0

This is in relation to a previous question I asked here. Calling replaceAll("\n", "<br />") and then Html.fromHtml() will properly format the text in pre-Ice Cream Sandwich; however, as you can see from the photo it does not work in ICS. I’ve tried at least thirty different ways to capture and replace the line breaks in the text, but I come up empty handed. Is there something in particular I need to call in ICS, is this a bug, has anyone else experienced this problem? Can anyone think of a work around, because there’s got to be one. Also, can anyone offer some insight as to why this may be happening? It’s very peculiar.

To be clear: I’ve tested this on Froyo and Gingerbread and the text formatted properly. In Ice Cream Sandwich, it does not.

Here’s an example of the text being returned from Last.fm. Scroll to the bottom, it starts at “content”. Bon Iver URL

Here’s a demo app if you’re interested in testing it first hand. http://dl.dropbox.com/u/2301775/lastfm-api-test.zip

Here are two screenshots illustrating what I mean. They are from the test app. The first running Gingerbread and the second running Ice Cream Sandwich.

Gingerbread screenshot

Ice Cream Sandwich screenshot

  • 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-29T10:24:20+00:00Added an answer on May 29, 2026 at 10:24 am

    (removed old entry… tested the test project)

    There is a extremely interesting “issue” but I am not sure who is responsible for it.

    I tested your app and got it working.
    I was looking on a 2.2 device, where the first \n appears (index 413) in the string and than I took a look at this index at the ICS version. There I could only find a \r.

    You can see the difference in the LogCat, too. On ICS you see scrambled text with no sense but below ICS you can read the complete text without any problem.

    So instead of replacing \n with <br/> you should replace \r, too. I would, just to make sure, replace in this order:

    1. \n\r
    2. \n
    3. \r

    Step 1 is important to remove the possibility, that you “double” the breaks if someone uses the \n\r…

    Used working code:

    String artistText = artistInfo.getWikiText();
    Log.i("Log", artistText);
    artistText = artistText.replaceAll("\n\r", "<br />");
    artistText = artistText.replaceAll("\n", "<br />");
    artistText = artistText.replaceAll("\r", "<br />");
    System.out.println(artistText);
    txtWiki.setText(Html.fromHtml(artistText));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is in relation to a previous question I've asked ... see SQL
In relation to this previous question I am trying to create a batch file
In relation to a previous question of mine found here: Autorun the Faye server
This question has a relation with my previous question, What is the real memory
In relation to my previous question here . If I am using the below
This is in relation to my previous question: D concurrent writing to buffer Say
In relation to this question on Using OpenGL extensions , what's the purpose of
This is in relation to this question I am hosting this WCF service in
In relation to this stackoverflow question , how would I go about creating my
In relation to this question ( Efficient hashCode() implementation ) I have one more

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.