BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-28-2008, 05:52 AM   #1
ahmadgee
Thumbs Must Hurt
 
Join Date: Apr 2008
Model: 7100T
PIN: N/A
Carrier: do not know
Posts: 51
Default Please Help in HttpConnection?

Please Login to Remove!

Hi every body,

I am new in BB programming and try to connect to internet through the http connection. When I ran this programme and clicked on the project icon using simulator Then it could not open the icon and could not display error as well.

Can any body help me where am I wrong.
Thanks and kind regards,

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.i18n.*;
import net.rim.device.api.system.*;
import javax.microedition.io.*;
import java.io.*;

class ReadWebpageContents extends UiApplication{
HttpConnection connection = null;
InputStream stream = null;
StringBuffer b = new StringBuffer();

public void getReadWebpageContents(){

try {
connection = (HttpConnection)Connector.open
("http://www.cinq.net/bbtest.txt");
stream = connection.openInputStream();
int ch;
while ((ch = stream.read()) != -1) {
b.append((char) ch);
}
MainScreen screen=new MainScreen();
screen.add(new LabelField(b.toString()));
pushScreen(screen);

System.out.println("connection closed");
}catch (IOException e) {

}
}

public static void main(String args[]){
ReadWebpageContents rwc=new ReadWebpageContents();
rwc.getReadWebpageContents();
rwc.enterEventDispatcher();
}
}
Offline  
Old 04-28-2008, 07:12 AM   #2
Dinan3
CrackBerry Addict
 
Dinan3's Avatar
 
Join Date: Oct 2007
Location: The Land of Ferraris, Moviestars, and Bumbs
Model: 9000
PIN: & Teller
Carrier: AT&T
Posts: 590
Default

ahmadee, welcome to the forums.

you might get better help if you post this in our developer's forum.

Good Luck!
__________________
When you turn on your phone, does it return the favor? Welcome to BlackBerry!
________________
ubuntu-LINUX 8.04
Offline  
Old 04-28-2008, 08:02 AM   #3
ahmadgee
Thumbs Must Hurt
 
Join Date: Apr 2008
Model: 7100T
PIN: N/A
Carrier: do not know
Posts: 51
Default Thank you very much

Thank you very much for the direction.
Best regards,
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


6FC5610-0BA10-0AA1 SIEMENS LCD Screen Display 1PCS picture

6FC5610-0BA10-0AA1 SIEMENS LCD Screen Display 1PCS

$2998.00



1PC New SIEMENS 6ES7151-1AB05-0AB0 6ES71511AB050AB0 Expedited Shipping PLC picture

1PC New SIEMENS 6ES7151-1AB05-0AB0 6ES71511AB050AB0 Expedited Shipping PLC

$1244.00



Siemens Simatic ET 200S PLC 6ES7 151-7FA21-0AB0 C-H8BS7760 picture

Siemens Simatic ET 200S PLC 6ES7 151-7FA21-0AB0 C-H8BS7760

$779.99



6AV6643-0BA01-1AX0 Siemens SMART PLC Module 6AV6643-0BA01-1AX0 New In Box picture

6AV6643-0BA01-1AX0 Siemens SMART PLC Module 6AV6643-0BA01-1AX0 New In Box

$885.00



Siemens 6SN1146-1AB00-0BA1 Industrial Control System picture

Siemens 6SN1146-1AB00-0BA1 Industrial Control System

$560.00



Siemens Operator Panel OP77A 6AV6 641-0BA11-0AX1 picture

Siemens Operator Panel OP77A 6AV6 641-0BA11-0AX1

$299.99







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