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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:53:48+00:00 2026-06-01T17:53:48+00:00

I’m using a textview to hold a string coming from a web service. String

  • 0

I’m using a textview to hold a string coming from a web service. String comes with a format like this. “sample text {{b}}bold text{{/b}} and so on”. I need to show the bold text bold in my textview. in a single operation I just can pass the string. Do I have a chance to use a string with color, font, etc properties?

Note: I don t have problems with parsing the text I just want to find a way to pass my parsed text to textview.

Thanks

  • 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-01T17:53:49+00:00Added an answer on June 1, 2026 at 5:53 pm

    I solved this problem by using SpannableString, for who who needs code, can change this class as they wish

    public class RichTextHelper {
    public static SpannableStringBuilder getRichText(String text){
        SpannableStringBuilder builder=new SpannableStringBuilder();     
        String myText=text;
        boolean done=false;
        while(!done){
            if((myText.indexOf("{{b}}")>=0) && (myText.indexOf("{{b}}")<myText.indexOf("{{/b}}"))){
                int nIndex=myText.indexOf("{{b}}");
                String normalText=myText.substring(0,nIndex);
                builder.append(normalText);
                myText=myText.substring(nIndex+5);
            }else if((myText.indexOf("{{/b}}")>=0)){        
                int bIndex=myText.indexOf("{{/b}}");
                String boldText=myText.substring(0,bIndex);
                builder.append(boldText);
    
                myText=myText.substring(bIndex+6);
                int start=builder.length()-bIndex-1;
                int end =builder.length();//-1;
                if((start>=0) && (end>start)){
                    builder.setSpan(new StyleSpan(Typeface.BOLD), start, end, 0);
                }
    
            }else{
                if(myText.contains("{{/b}}"))
                    myText=myText.replace("{{/b}}", "");
                builder.append(myText);
                done=true;
            }
        }
    
        return builder;
    }
    

    }

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
I have a bunch of posts stored in text files formatted in yaml/textile (from

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.