here is the whole procedure. please, help to retrieve the image from a url and to put it into an image variable
protected void cargarItemsNivel(int nivel)
{
System.out.println("cargarItemsNivel()");
ConnectionRequest r;
r = new ConnectionRequest()
{
@Override
protected void readResponse(InputStream input) throws IOException
{
// InfiniteProgress prog = new InfiniteProgress();
// Dialog dlg = prog.showInifiniteBlocking();
final String url = "
http://www.personallinks.com.ar/imagenes/slider/villaVentania.jpg";
// Display.getInstance().getCurrent().getContentPane().removeAll();
InputStreamReader reader = new InputStreamReader(input);
JSONParser parser = new JSONParser();
Hashtable response = parser.parse(reader);
Vector registros = (Vector) response.get("root");
Component c = Display.getInstance().getCurrent();
/* ---- i tried to load the image into the label , but it didnt work .. why? */
Label myLabel = (Label) findByName("Label",c);
ImageDownloadService.createImageToStorage(url, myLabel,"222222", new Dimension(20,20));
/*---------------------------------------------------------------------------*/
List objLista = (List) findByName("ListItems",c);
Vector vec = new Vector();
for (int i=0; i<registros.size();i++)
{
Hashtable registro = (Hashtable)registros.elementAt(i);
String descripcion = (String)registro.get("$descripcion");
Hashtable h = new Hashtable();
h.put("LblCaption",descripcion);
/* In the next code i try to load the image , but never loads and shows the image from de resource file. */
/*******************/
MultiButton mb = new MultiButton();
mb.setTextLine1(descripcion);
mb.setIcon(tmp);
Display.getInstance().getCurrent().getContentPane().addComponent(mb);
}
Display.getInstance().getCurrent().getContentPane().repaint();
myLabel.repaint();
}
};
r.setUrl("
http://www.personallinks.com.ar/basedoble/wyn.php");
r.setPost(false);
r.addArgument("task", "getNivel");
r.addArgument("uid", "0");
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
r.setDisposeOnCompletion(dlg);
NetworkManager.getInstance().addToQueue(r);