开发者

blackberry show image with HTML in a field

开发者 https://www.devze.com 2023-03-17 08:13 出处:网络
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

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.i.e. "$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).

0

精彩评论

暂无评论...
验证码 换一张
取 消