Load external Images

4 messages - 851 views

I want to make a Grid where i have a list of items and each item has an image. Each item an the image of each item is loaded from a Web Services.

I manage to load each of the item name in the grid and now i want to load each image, but i don't know how to do this.

I load the data by a List Provider and i can load the image url or the image object directly but i don't know what to put in the xml file.

I have this in the XML:

 <scrollPane >
    <list>
     <_renderer><![CDATA[
      <listitem>
       <picture>${vType}.png</picture>
       <textarea>${sTitle}</textarea>
      </listitem>
     ]]></_renderer>
     <_items>@{lMedias}</_items>
    </list>
 </scrollPane>

It only works if the Image are preaviously loaded in my resource folder. Anyone know how to do this?

Thanks, AR

 

The Picture widget has two way to get image data.

1. from a classpath location :

<picture src="path_to_image/img_file.ext" />


2. from a lcdui Image instance :

<picture>

<_image>@{myImageProperty}</_image>

</picture>

In the second case, you can load the Image from where you want and and give it to the picture widget through a dataprovider.

It works! Thank you very much! Here is working my XML:

 <scrollPane>
    <list>
     <_renderer><![CDATA[
      <listitem>
       <picture>
       <_image>@{vType}</_image>
       </picture>
       <textarea>${sTitle}</textarea>
      </listitem>
     ]]></_renderer>
     <_items>@{lMedias}</_items>
    </list>
 </scrollPane>

what is the type for lMedias in your DataProvider?