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
ETitus
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10
My Carrier: Ben(T-Mobile network)
Accepted Solution

Scrolling through list view lags

I have a listview with a container with an image and text:

 

                        ListItemComponent {
                            type: "item"
                            Container {
                                layout: StackLayout {
                                    orientation: LayoutOrientation.LeftToRight
                                }
                                ImageView {
                                    imageSource: ListItemData.imagePath
                                    scalingMethod: ScalingMethod.AspectFill
                                    rotationZ: ListItemData.imageRotation
                                }
                                Label {
                                    text: ListItemData.imageText
                                    multiline: true
                                    horizontalAlignment: HorizontalAlignment.Fill
                                    autoSize.maxLineCount: 10
                                }
                            }
                        }

 The images are taken with the camera and copied to the app folder. In the listview the images look like (I guess)  ninesliced thumbnails of the picture.
Scrolling through the listview starts to lag when there are 5 or more entries. It justs waits before showing the next image and then it shoots forwards.

I´m guessing it has something to do with the images being `large` and their loaded and unloaded dynamically.

I tried both bufferedScrollingEnabled true and false.

 

Any way to solve this easily?


OR do I just need to make thumbnails of some sort in CPP? In that case, how?

 

Thanks!

Don't forget to mark as solved and like my post if it helped out!
Please use plain text.
Developer
BBSJdev
Posts: 5,948
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: Scrolling through list view lags

Even with thumbnails it may lag, the documentation suggests making it asynchronous with a single generic picture so the user can still scroll while the pictures are loaded.

 

Take a look at this...

 

http://developer.blackberry.com/native/documentation/cascades/ui/lists/asynch_data.html


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

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
ETitus
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10
My Carrier: Ben(T-Mobile network)

Re: Scrolling through list view lags

Hi BBSJdev,

 

Thanks! I'll take a look at it, it looks promosing though. I understand you either get like the facebook behaviour, where when you reached the end it starts fetching new data, or the approach where it just displays empty pictures if you scroll to fast.

 

I was wondering though if it is possible to mimmick the pictures app, that seems like an infinite scrolling list without loading or empty pictures.

 

I'm using a QML mostly with a XML data model and as few as possible CPP, so the Async solutions look quite scary

Don't forget to mark as solved and like my post if it helped out!
Please use plain text.
Developer
BBSJdev
Posts: 5,948
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: Scrolling through list view lags

I would quickly check the performance of a c++ implementation, if you are still lagging then possibly look at precaching and async.


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

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
BlackBerry Development Advisor
IsaacGordezky
Posts: 57
Registered: ‎10-04-2012
My Device: developer
My Carrier: none

Re: Scrolling through list view lags

You may need to scale your images. If you are displaying large images in the list view, then it will have to decode and scale these images as you scroll up and down.

 

It is possible to scale images with QImage and cache the thumbnails for later use. I suggest that you use a separate thread to do this, and save thumbnails to tmp and load them from their uri in your list. If you pass image data directly to the list view, then you will need to manage image caching and memory overhead yourself and you will still need significantly more memory.

Please use plain text.
Developer
ETitus
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10
My Carrier: Ben(T-Mobile network)

Re: Scrolling through list view lags

Hi Isaac,

I'll check the QImage out, just look for the scale function?

If you want I can add you to my sandbox so you can sandbox the app I'm experiencing the trouble in when adding 5 or more entries in the listview:
http://appworld.blackberry.com/webstore/content/35229891/

Let me know your BBID if you are interested
Don't forget to mark as solved and like my post if it helped out!
Please use plain text.
Developer
ETitus
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10
My Carrier: Ben(T-Mobile network)

Re: Scrolling through list view lags

Making thumbs and save them did the trick :smileyhappy:

Don't forget to mark as solved and like my post if it helped out!
Please use plain text.