Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
JoVinz
Posts: 255
Registered: ‎05-03-2012
My Device: 9930
My Carrier: Vodafone

Problem in network connection

I want to fetch data from server. 

I am using following code and run it on device bt its giving responsecode 0.

 

InputStream _is = null;
HttpConnection httpConnection = null;
ConnectionFactory factory = null;
ConnectionDescriptor descriptor = null;
factory = new ConnectionFactory();
descriptor = factory.getConnection(url);
if (descriptor != null)
httpConnection = (HttpConnection) descriptor.getConnection();
else
httpConnection = (HttpConnection) Connector.open(url);

final int iResponseCode = httpConnection.getResponseCode();
if(iResponseCode == HttpConnection.HTTP_OK)
_is = httpConnection.openInputStream();
else
return null;

 

Please Help.

Thanx

Please use plain text.