Use DataProvider with Picture widget

2009-02-11 17:25
Submit by Tofu

The Picture widget has an image attribute where you can pass a dynamic value. The type of the value need to be a javax.microedition.lcdui.Image.

XML :

...

<picture>

<_image>@{myImage}</_image>

</picture>

...

Java (the DataProvider associated with the previous XML content) :

public class MyImageDataProvider extends DataProvider {

private Image myImage;

 

public void loadMyImage() {

// Place somewhere your loading image implementation ...

// And after loading do something like :

dispatchUpadateEvent("myImage");

}

 

public Object getUserDefinedValue(String property) {

if ("myImage".equals(property)) {

return myImage;

}

return null;

}

}

 

 


Tags: dataprovider picture image Popularity: 976