Possible Duplicate:
Unable to connect to internet in Blackberry device?
I’m trying to send an http request and get a response via blackberry. I used following code snippet.
String url="http://www.google.lk/";
HttpConnection con = null;
InputStream is = null;
try {
con = (HttpConnection) Connector.open(url);
int responseCode = con.getResponseCode(); // LINE X
Dialog.alert(String.valueOf(responseCode ));
}
catch(Exception e){
Dialog.alert(e.getMessage());
}
But the code never passes LINE X. There’s no error. It just waits and eventually gets a timeout. What could be the problem?
Thanks in advance.
You need to Tell Http Request about your connection type.
use this code To access Connection type
use