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

Native Development

Reply
Developer
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

How to load images asynchronously to the listview

Hi all,

 

Is there any sample available to load images to the listview asynchonously. 

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How to load images asynchronously to the listview

Take a look at this...

 

http://blackberry.github.io/Cascades-Samples/imageloader.html


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Highlighted
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: How to load images asynchronously to the listview

[ Edited ]

Hi,

An example, but it will probably require a lot of tweaking (caching and reusing the processed images etc):
http://blackberry.github.io/Cascades-Samples/imageloader.html

 

 

Smiley Happy

 

upd:

 

One of the problems with this class is that it creates QNetworkAccessManager for every image.

So, it will not throttle the requests and will start loading all the images at the same time. This won't work for large number of images. It also leaks memory. It's not  production-ready.

 

void ImageLoader::load()
    {
        m_loading = true;
        emit loadingChanged();

        QNetworkAccessManager* netManager = new QNetworkAccessManager(this);

 

 


Andrey Fidrya, @zmeyc on twitter