0

I have a LWUIT form in my j2me based application. I am getting my data through RSS Feeds(including image path). Now i want to show the images through RSS feeds image path in my LWUIT Form. I am using HTMLComponent for that purpose. The html based text is loading fine but the images are not being shown. Following is my code snippet.

             HTMLComponent htmlComp = new HTMLComponent();
             htmlComp.setPreferredSize(new Dimension(300,300));
             String imagePath=myItem.getImagePath().trim();
             htmlComp.setShowImages(true);
             String myHtml="<b>Hello</b> <br/> <img src= \""+imagePath+"\" /> ";
             System.out.println(myHtml);    
             htmlComp.setHTML(myHtml,null,null,false);
             addComponent(htmlComp);

The image path is like "http://toffeetv.com/wp-content/uploads/2012/06/f_swan-150x150.jpg". Why the images are not being shown? Can anybody help me with an appropriate code example?

user1001084
  • 115
  • 1
  • 10

1 Answers1

1

The HTML Component accepts a base URL as one of its arguments to that method. Just set the URL to the appropriate path and it should work as expected.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • HI,Even I'm also tried to display the image on LWUIT Form from Html String ,but I'm not able to display the image,Can you Provide me the sample code? – String Oct 12 '12 at 11:52