HI! its a bug or im doing something wrong? my code executes well but
e.getProgressPercentage() allways returns -1.
my code is:
ConnectionRequest r = new ConnectionRequest()
{
protected void readResponse(InputStream input) throws
IOException
{
OutputStream o = null;//=
Storage.getInstance().createOutputStream("sdj.pdf");
final String strDestino =
com.codename1.db.Database.getDatabasePath("CeliGUIDE.sqlite");
o =
FileSystemStorage.getInstance().openOutputStream(strDestino);
Util.copy(input, o);
o.close();
DB_OFFLINE_UPDATED = true;
}
public void postResponse()
{
lblProgreso.setText("Finalizado");
lblProgreso.repaint();
statParams.setParam("fechaUltimoLogin", now());
dispose();
}
};
r.setUrl("http://www.xxxxxx.com");//SERVER
r.setPost(false);
r.setTimeout(20000);
ActionListener al = new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
Log.p("Evento de descarga ");
if (evt instanceof NetworkEvent)
{
Log.p("Evento de descarga -1");
NetworkEvent e = (NetworkEvent) evt;
Log.p("Porcentaje descargado: - " +
String.valueOf(e.getProgressPercentage()));
if (e.getProgressPercentage() > -1 && prevIndex !=
e.getProgressPercentage())
{
prevIndex = e.getProgressPercentage();
Log.p("Progress: " +
String.valueOf(e.getProgressPercentage()));
lblProgreso.setText("Progreso:" +
String.valueOf(e.getProgressPercentage()) + "%");
//lblProgreso.repaint();
/*
}
});
*/
}
}
}
};
NetworkManager.getInstance().addProgressListener(al);
NetworkManager.getInstance().addToQueueAndWait(r);
// r.kill();
//Log.p("DialogDescargarTablas - hice kill ",Log.INFO);
NetworkManager.getInstance().removeProgressListener(al);
}
If you are experiencing an issue please mention the full platform your
issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/56661921-cb64-4761-adea-fe3f70256920%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.