Welcome!

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

Reply
Trusted Contributor
arunimi123
Posts: 182
Registered: ‎09-22-2011
My Device: 9700

Lazy loading issue in blackberry

I have a listfield where i am displaying text and image.I am fetching the image from server and showing it by lazy loading.Everythng is fine bt as long as the lazy loading is going on i cant scroll into the listfield smoothly.After all d images hav been replaced i can scroll again.Plz help

Developer
swap_chau
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550

Re: Lazy loading issue in blackberry

Can you download it beforehand?

Developer
peter_strange
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Lazy loading issue in blackberry

If you are using a more recent device, or the Simulator, and you are seeing this problem, then I suspect you are downloading on the Event Thread.  Start a separate Thread for blocking activity, like Networking. 

 

If you are starting up a download Thread per image, then this might be causing you a performance problem.  Start a single Thread that processes all your images. 

New Contributor
kinjalshah_5320
Posts: 9
Registered: ‎07-02-2012
My Device: blackberry 9930,9900

Re: Lazy loading issue in blackberry

Hello friends,

 

How to use lazyloading in Blackberry...

 

Plz help me if  uhave any idea.....

 

 

Developer
peter_strange
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Lazy loading issue in blackberry

You have to code this yourself.

 

Start a background Thread to download the images.  When you have an image to download, put an entry in the queue for this Thread, and replace the image with a place holder.  When your downloading Thread loads the image from the server, it can replace the placeholder with the real image. 

 

There are management issues to contend with (like starting and stopping this Thread), but they are secondary to getting the downloading right.

 

You will need to be sure that the Thread runs in the background (you mist start it).  When you update the image, then you will need to swap to the Event Thread

(UiApplication.getUiApplication().invokeLater(....);

 

Good luck. 

Developer
shaan_softwaredvlpr
Posts: 172
Registered: ‎01-17-2011
My Device: 9500 series

Re: Lazy loading issue in blackberry

Hi

You need to download images in a seperate thread , actually what happens when you render a list row , it looks for bitmap image. 
So What you can do once you are creating your List view. provide a default loading bitmap image , start a thread to download image ,  

New Contributor
kinjalshah_5320
Posts: 9
Registered: ‎07-02-2012
My Device: blackberry 9930,9900

Re: Lazy loading issue in blackberry

Can u give an example with coding??

Developer
peter_strange
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Lazy loading issue in blackberry

It is not really that possible to give a useful example in code here, the complete code would be quite large and confusing. 

 

Instead can you tell us which part of this process you are having problems with and then we can help you write it.