Alert problem
Hi guys! I have a problem with an Alert
I connected my phone with a database using a servlet. I would like that while it is trying to connect with the database, it will show an Alert with a gauge.
this is the code:
privatevoid infoAlert(Display display)
{
Alert info =new Alert("Information","Connecting to the server", null,null);
info.setTimeout(Alert.FOREVER);
Gauge indicator =new Gauge (null,false,Gauge.INDEFINITE,Gauge.CONTINUOUS_RUNNING);
info.setIndicator(indicator);
display.setCurrent(info);
}
I call this method when i try to connect the phone with the server:
try
{
http = (HttpConnection) Connector.open(url);
http.setRequestMethod(HttpConnection.GET);
if (http.getResponseCode() == HttpConnection.HTTP_OK)
{
infoAlert(display);
byte servletData[]=null;
input = http.openInputStream();
int length = (int) http.getLength();
if (length > 0)
{
...................
.....................
................
servletData =newbyte[length];
input.read(servletData);
.......................
.......................
}
when I get back the data from the server the display will show the form that contains them
It work on the emulator but on my phone it doesn't work and i got this exception: java.lang.IllegalArgumentException: Alert cannot return to Alert
I also tryied info.setTimeout(5000);
but it doesn't work!!!!
please could someone help me? Tell me where I do some mistake or tell me some other way to do it?
thanks
antonio

