BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-01-2009, 03:18 AM   #1 (permalink)
New Member
 
Join Date: Jun 2009
Model: 9350
PIN: N/A
Carrier: no
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default HTTP connection time out and component set Position problem...

Please Login to Remove!

Hi Everybody,



I am noobie in BlackBerry software development. I use JDE to develop the BlackBerry, and I meet the problem in Http connection and Component Set Position problem.



In the HTTP connection, I have copy one of the sample. It is pass when I build it, but no response (without error....) after I run it.

This is what I copy:

----------------------------------

HttpConnection httpConnection=null;
httpConnection = (HttpConnection) Connector.open(url, Connector.READ_WRITE);
httpConnection.setRequestMethod(HttpConnection.GET );
InputStream inputStream=null;
int responseCode = httpConnection.getResponseCode();

if (responseCode == HttpConnection.HTTP_OK) {
inputStream = httpConnection.openInputStream();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

byte[] buffer = new byte[256];
int len = 0, imageSize = 0;

while (-1 != (len = inputStream.read(buffer))) {
byteArrayOutputStream.write(buffer);
imageSize += len;
}
byteArrayOutputStream.flush();
byte[] imageData = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
System.out.println("----------------");
System.out.println(imageData);
System.out.println("----------------");

}

----------------------------------

The result is connection timeout..... I confirm that my url is right and it can browse by IE and FF. So I don't know what is wrong.



I know that TextField is created in the MainScreen class, but I cannot set its position. I try to use setPositionChild(object, x, y) to set the component directly. It build success but throw exception in the debugging. So I want to know how to set the component position.
Offline  
Old 06-01-2009, 06:30 AM   #2 (permalink)
New Member
 
Join Date: Jun 2009
Model: 9350
PIN: N/A
Carrier: no
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by fenixlam View Post
Hi Everybody,



I am noobie in BlackBerry software development. I use JDE to develop the BlackBerry, and I meet the problem in Http connection and Component Set Position problem.



In the HTTP connection, I have copy one of the sample. It is pass when I build it, but no response (without error....) after I run it.

This is what I copy:

----------------------------------

HttpConnection httpConnection=null;
httpConnection = (HttpConnection) Connector.open(url, Connector.READ_WRITE);
httpConnection.setRequestMethod(HttpConnection.GET );
InputStream inputStream=null;
int responseCode = httpConnection.getResponseCode();

if (responseCode == HttpConnection.HTTP_OK) {
inputStream = httpConnection.openInputStream();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

byte[] buffer = new byte[256];
int len = 0, imageSize = 0;

while (-1 != (len = inputStream.read(buffer))) {
byteArrayOutputStream.write(buffer);
imageSize += len;
}
byteArrayOutputStream.flush();
byte[] imageData = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
System.out.println("----------------");
System.out.println(imageData);
System.out.println("----------------");

}

----------------------------------

The result is connection timeout..... I confirm that my url is right and it can browse by IE and FF. So I don't know what is wrong.



I know that TextField is created in the MainScreen class, but I cannot set its position. I try to use setPositionChild(object, x, y) to set the component directly. It build success but throw exception in the debugging. So I want to know how to set the component position.
The Connection timeout problem had been solved. That is because I don't install the MDS service. But the set Position problem still not idea......

HELP!!!~
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Hama "SD/MMC" Memory Card Labels - self-adhesive labels (Multi, Square, Paper, S
$16.73
Hama Siemens 6ES7952-1AL00-0AA0 Memory Card Module
$125.0
Siemens 6ES7952-1AL00-0AA0 Memory Card Module pictureAllen Bradley 1747-M13 /A Flash Memory Module 64K EEPROM SLC 500
$45.0
Allen Bradley 1747-M13 /A Flash Memory Module 64K EEPROM SLC 500 pictureLexar Multi-Use 32GB SDHC Flash Memory Card (LSD32GASBNACL6)
$22.15
Lexar Multi-Use 32GB SDHC Flash Memory Card (LSD32GASBNACL6)  pictureUsed 3x Siemens 6ES7953-8LG11-0AA0 1x 6ES7953-8LG20-0AA0 Memory Card 128 KB
$45.0
Used 3x Siemens 6ES7953-8LG11-0AA0 1x 6ES7953-8LG20-0AA0 Memory Card 128 KB  picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.