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

Regular Contributor
Posts: 70
Registered: ‎04-14-2010
My Device: bold 9000
My Carrier: new
Accepted Solution

thread problem

thanks to you all , i can step vy step


as last my post

i want to get image from server

simply, i just tested 17times loop



while( i++ < 17)


Field imageField = new WebBitmapField(url)
//Coderholic - Blackberry WebBitmapField


it returned : too many thread errror

finally i  found "A single application can create up to 16 threads."




where should i turn off thread  in webBitmapField





Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: thread problem

That class creates, for each field, a new Thread that does not exit until the image is downloaded or it encounters an error. You can't "turn off" the thread. Assuming that you are starting your loop with i==0, the problem is that you are creating 17 WebBitmapFields, and hence too many Threads, basically all at once.


I'd suggest that you write your own worker Thread that will load the images one after the other. Once finished, it can call back to the event thread with a Runnable to create normal BitmapFields using the (now-loaded) images. (Alternatively, it can do that for each image as it comes in.) You can use pieces of the WebBitmapField code as patterns for your own thread. (After all, Coderholic writes, "Feel free to use it," so go for it! Smiley Happy)

Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.