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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:19:16+00:00 2026-05-23T13:19:16+00:00

I am using the BlackBerry knowledge center tutorial How To Format RichTextField to set

  • 0

I am using the BlackBerry knowledge center tutorial “How To Format RichTextField” to set a format for my RichTextField.

I encountered some difficulty when formatting text like:

A I was walking in the street B suddenly I saw a flying dog

If I want to bold only the letters A & B I need to have their string indexes and length.

I created 2 arrays, one handles the indexes of the letters in the entire text and the second array handles the length of each letter index, for example: A (length 1), WC(length 2).

I tried to run it in a loop but it doesn’t work:

Font fonts[] = new Font[2];
    int[] offset = new int[3];
    byte[] attribute = new byte[3];

    //Get three instances of the default font.
    //On plain, one bold and one bold and italic.
    fonts[0] = Font.getDefault();
    fonts[1] = Font.getDefault().derive(Font.BOLD);

    for (int i = 0; i<lettersLength; i++) {
      offset[0] = letterIndexes[i]; //handles the indexes of the letters in the entire text
      attribute[0] = 1;
      offset[1] = letterLength[i]; //handles each letter index
    }
  • 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-23T13:19:17+00:00Added an answer on May 23, 2026 at 1:19 pm
    offsets[0] = 0; // index of A, first character
    attribute[0] = 1;  // Choose the bold font starting at offsets[0]
    offsets[1] = 1;  // 1 past the desired bold
    attributes[1] = 0;  // assign the regular font starting at offset[1]
    offsets[2] = index of 'B';
    attributes[2] = 1; // set the style to the bold font for this
    offsets[3] = index of 'B' + 1; // the new non bold segment starts just after the B
    attributes[3] = 0; // set the style to normal
    

    Sorry not nicer code, but hope it helps.

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

Sidebar

Related Questions

I don't know how to show Time in AM/PM format in blackberry using blackberry
I created a CustomButtonField in blackberry using that i can able to set our
I am using SAX Parser to parser XML file on Blackberry platform. Some XML
I am using Blackberry plug in for eclipse. Default jre setting is 1.6 I
I'm using Blackberry's ESS that includes support for sending an email to its own
I am developing blackberry application using BlackBerry JDE 5.0.X , in which i am
I am using the Blackberry SDK 4.6 eclipse plugin to create applications. My applications
I am developing a blackberry application using j2me and LWUIT (blackberry port). Everything works
When using an HttpConnection in a BlackBerry app, you often get HTTP cookies in
I am using Eclipse to develop a Blackberry Java application.Is possible to automatically increment

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.