I am working on a J2ME application, it makes a HTTP request and works accordingly to the response received.
Below is my code for HTTP request
public String sendHttpGet(String url, String str) throws Exception {
HttpConnection hcon = null;
DataInputStream dis = null;
StringBuffer message = new StringBuffer();
try {
hcon = (HttpConnection) Connector.open(url);
dis = new DataInputStream(hcon.openInputStream());
int ch;
while ((ch = dis.read()) != -1) {
message.append((char)ch);
}
}catch(Exception e){
}finally {
if (hcon != null) {
hcon.close();
}
if (dis != null) {
dis.close();
}
MyForm.show();
}
return message.toString();
}
It is working fine on non touch devices, but when I checked it on Nokia 500 touch phone,
the code executes till line
hcon = (HttpConnection) Connector.open(url);
without throwing any exception, it ends up to show first screen of the application (Main Menu).
Is there any limitation or problem?
Any solution?