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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:48:39+00:00 2026-05-29T05:48:39+00:00

I’m developing a BlackBerry app which uses an embedded browser to display html content.

  • 0

I’m developing a BlackBerry app which uses an embedded browser to display html content.
Testing application on Torch I’ve realized that only project embedded images are displayed by browser, while I’ve got problems accessing image resource files stored on removable SD card or internal file system.
The same application running on Curve displays correctly all the images.
Here is a fragment of code:

    browser = new BrowserField();

    Strimg img_1 = "file:///store/home/user/yellow.png";
    Strimg img_2 = "file:///SDCard/green.png";
    Strimg img_3 = "file:///local/images/red.png";

String  imgTag_1 = "<img src=\"" + img_1 + "\">"; // Stored on file system - Not displayed by Torch
String  imgTag_2 = "<img src=\"" + img_2 + "\">"; // Stored on SDCard - Not displayed by Torch
String  imgTag_3 = "<img src=\"" + img_3 + "\">"; // Embedded image

String browserContent = "<html>" + imgTag_1 + imgTag_2 + imgTag_3 + "</html>";

byte[] contentBytes;        
try {
    contentBytes = browserContent.getBytes("UTF-8");
    browser.displayContent(contentBytes, "text/html; charset=UTF-8", "http://mysite.com");
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
    browser.displayContent(browserContent, "http://mysite.com");
}

aVerticalManager.add(browser);

I’m using JRE 5 both for Curve and Torch.
Using FileConnector to accessing file works fine.

Any suggestions on how to display images both on Torch and Curve?
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-05-29T05:48:40+00:00Added an answer on May 29, 2026 at 5:48 am

    Solved!
    Hereafter the code describing how I did it:

    browser = new BrowserField();    
    String img_1 = "file:///store/home/user/yellow.png"; // File Sistem
    
    byte[] byt_1    = MyUtilClass.readBytesFromFile(img_1);
    char[] base64_1 = MyUtilClass.Base64.encode(byt_1);
    
    // Sample of generating HTML: <html><img src="data:image/bmp;base64,Axcfhhòjbnesohokòbw...."></img></html>
    String imgTag_1 = "<html><img src= \"data:image/bmp;base64,"+ String.valueOf(base64_1) + "\" ></img></html>";
    
    byte[] contentBytes;       
    
    contentBytes = imgTag_1.getBytes("UTF-8");
    
    // Inject HTML in browser
    browser.displayContent(contentBytes, "text/html; charset=UTF-8", "http://mysite.com");
    

    So, this works fine on Torch, but I have poor performances on Curve. I’ll specialize the behaviour depending on device type.

    if ( Curve == true ) {
    // Use: <img src=file:///store/home/user/yellow.png>
    } else  {
    // Use: <img src="data:image/bmp;base64,Axcfhhòjbnesohokòbw...."></img>
    }
    

    I know that is a workaround, but it works!

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
i want to parse a xhtml file and display in UITableView. what is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string

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.