BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 06-01-2009, 03:18 AM   #1
fenixlam
New Member
 
Join Date: Jun 2009
Model: 9350
PIN: N/A
Carrier: no
Posts: 7
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
fenixlam
New Member
 
Join Date: Jun 2009
Model: 9350
PIN: N/A
Carrier: no
Posts: 7
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Motorola 68060 68EC060 MC68EC060RC75 CPU / Processor AMIGA unused, new USA stock picture

Motorola 68060 68EC060 MC68EC060RC75 CPU / Processor AMIGA unused, new USA stock

$69.99



New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga 1591 picture

New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga 1591

$28.25



New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga PC Case 1598 picture

New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga PC Case 1598

$36.15



6500/1 A 6502 VARIENT CPU COMMODORE USE IN AMIGA KB & 1520 PLOTTER NMOS NCR NOS picture

6500/1 A 6502 VARIENT CPU COMMODORE USE IN AMIGA KB & 1520 PLOTTER NMOS NCR NOS

$5.89



Mitsubishi FR-A540-0.75K-NA AC DRIVE INVERTER 1 HP 380-480 VAC 50/60 HZ 4.1 AMP  picture

Mitsubishi FR-A540-0.75K-NA AC DRIVE INVERTER 1 HP 380-480 VAC 50/60 HZ 4.1 AMP

$649.99



Camera Precise Positioning Support Video Record for Acmer Laser Engraving picture

Camera Precise Positioning Support Video Record for Acmer Laser Engraving

$150.78







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