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

Posts: 35
Registered: ‎11-26-2008
My Device: 8100

regarding Multiple http connection



i have used this snippet to load image (i have to load images which reside in other server)



Blackberry WebBitmapField


i can load image successfully once for one image


but if i make an array of image urls and pass it to above class then it creates problem

class uses thread

for each image i made object of this class and passed image url

it runs well for first image but when it tries to create object for second one, it throws an exceptipon that "cann't create new object.. object already exist "


what i reckoned this is due to httpconnection

i think i can not make multiple connection at a time...


and my requirement is to load 10 image in one screen


so i think i have to wait untill http connection close and make other http request for sub sequent images


and this is bad


anyone who knows the solution or

knows how to load images (resides on other server )

so images will be loaded in thread and mean while data is displayed



Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: regarding Multiple http connection

Posts: 146
Registered: ‎11-05-2008
My Device: Not Specified

Re: regarding Multiple http connection

Only use one thread,from where can u connect with server and get image and put it in a class and add this object to a  vector and close the http connection and stream connection and increase the no and again connect with server.
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: regarding Multiple http connection

Getting a couple of short files is probably ok but expecting a long string of requests to work out

can be a bit much with out some retry or related logic- DNS errors are one common problem

on some carriers if you use deviceside=true for example. A background que with notification

or somekind of callback would be a good idea. Presumably you would also benefit from local

caching or other means to keep local copies when you restart the app etc.