简体   繁体   中英

blackberry show image with HTML in a field

i have been trying to display html content along with image (using src attribute), but have not been able to show the image.Rest of html works.I wonder what value should i give in to the src.My image location is: SDCard/someFolder/1.png.Iam targetting OS 5.0. please note i have to use the image from sdcard only

URI uri = URI.create("/SDCard/someFolder/1.png");

//replaced < by $ and > by & as this site dint let my use it :(

String htmlContent =  "$!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"&" +

"$HTML&" +

   "$BODY &" +

        "$form&" +

            "$div &$/div&" +

           " $input type=\"text\" &" +

    "$img src=" + uri  + " alt=\"some_text\"/& " +

            "$input type=\"submit\"&" +

        "$/form&" +

        "$b&Use the menu to change the search engine to use.$/b&" +

        "$br&" +

   "$/BODY&" +

"$/HTML&";


BrowserField myBrowserField = new BrowserField();

myBrowserField.displayContent(htmlContent, "http://localhost");

//add myBrowserField to screen;

Have you tried file:///SDCard/someFolder/1.png ?

got it working, Blackberry is so misleading, a simple path works instead of URI.ie "$img src= file:///SDCard/someFolder/1.png". this misleaded me: http://docs.blackberry.com/en/developers/deliverables/6176/HTML_ref_img_564118_11.jsp telling src expects URI.

Does the blackberry web browser have access to the file system on the phone? If not, I don't think there's much you can do. (All I can say is BB OS5's browser has more than a few bugs).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM