BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 03-27-2008, 04:19 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Nov 2007
Location: atm: Kunming norm: Berlin
Model: 8700v
PIN: N/A
Carrier: ChinaMobile
Posts: 55
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default wait for answer from http Connection

Please Login to Remove!

Hello,
I found a lot of threads about the fact that it is necessary to open a httpconnection in its own thread...
so I did that...

but how can I wait for the thread to be finished?
I start the thread in a method which should return the httpCon's response.
When I use thread.join() or just wait in a loop until a static value of the class the method is in is changed from the thread, it works fine in the simulator but on the device the app just freezes and does nothing(before the user is asked whether he wants to acceot the http Connection) until after quiet a long time an uncaught exception is reported " the app does not response"(or something like that)

Any ideas?
tia


edit: I don't want to process the response data in the thread, because I call this method from different places(where different things should be done withe the response data) so I needed one extra thread for each of the calls...????

J

Last edited by jenselense : 03-27-2008 at 04:54 AM.
Offline  
Old 03-27-2008, 12:33 PM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Implement the Observer Pattern.

Check out this thread.
__________________
Do your homework and know how to ask a good question.
Offline  
Old 03-28-2008, 12:15 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Nov 2007
Location: atm: Kunming norm: Berlin
Model: 8700v
PIN: N/A
Carrier: ChinaMobile
Posts: 55
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default :-)

Hi Richard,
I read your answer in this thread yesterday and tried it that way but it didn't work...now I have checked this solution again and found out why it didn't work yesterday....I updated the screen in the the listener but since it is called from the (not-ui)thread of course it didn't work...
just some runnables and invokeLater's later, everything works

Thanks...
J
Offline  
Old 03-28-2008, 06:34 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Model: 8800
Carrier: Orange
Posts: 181
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've written a getWebData method that does exactly what you want at Dowling.me.uk Blackberry WebBitmapField
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

DC 100V 10A 50A 100A Voltmeter Ammeter LED Dual Digital Volt Amp Meter Gauge
$0.01
DC 100V 10A 50A 100A Voltmeter Ammeter LED Dual Digital Volt Amp Meter Gauge pictureDayton 5X527 Clamp Meter AC Volt Ammeter Ohmeter
$9.95
Dayton 5X527 Clamp Meter AC Volt Ammeter Ohmeter pictureCase Tractor Temperature,Tachometer, Ammeter Gauge Set
$35.0
Case Tractor Temperature,Tachometer, Ammeter Gauge Set pictureMassey Ferguson Oil Pressure Gauge+ Ammeter 1080, 1100,1130,1150,135,150,165,175
$20.0
Massey Ferguson Oil Pressure Gauge+ Ammeter 1080, 1100,1130,1150,135,150,165,175 pictureIH FARMALL GAUGE SET COMBO,OIL,TEMP.,AMMETER FOR 240,300,330,340
$26.99
IH FARMALL GAUGE SET COMBO,OIL,TEMP.,AMMETER FOR 240,300,330,340 picture






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