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
Developer
ksykulev
Posts: 58
Registered: ‎07-09-2009
Accepted Solution

Complex Scrollable List

I want to implement a scrollable list with 20-50 items, and each row item will have a pretty complicated set of information to display, including images and text loaded from the web and text and images loaded from the device.

 

I searched the forums a little bit and noticed people had two primary approaches.

Custom VerticalFieldManager or a custom ObjectListField where they override the drawListRow function.

 

In terms of implementing something like this are those the only two options I have? And in terms of performance which one would be better to implement a list with 20+ items, where each row has a pretty complicated layout?

 

Thanks.

Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Complex Scrollable List

objectlistfield offers a good performance and would be much closer to the use case.

i would suggest to create a custom object with all the things displayed as attributes, analyze it in the drawListRow method to customize the painting.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
ksykulev
Posts: 58
Registered: ‎07-09-2009

Re: Complex Scrollable List

I first attempted to implment this with a VerticalFieldManager, and i noticed when i scroll through the list i get sluggish perfomance because it must repaint each visible item as it scrolls. I'm sure i probably didn't implement this in the best way...

but does an ObjectListField not do this?

Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Complex Scrollable List

objectlistfield repaints items only if they are focused, unfocused or scrolled in/out.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
Eugen
Posts: 467
Registered: ‎07-16-2009
My Carrier: Vodafone NL

Re: Complex Scrollable List

I agree with Simon, but main disadvantage of list is fixed height of rows. And it is a little tricky to avoid this restriction.

Please use plain text.
Developer
ksykulev
Posts: 58
Registered: ‎07-09-2009

Re: Complex Scrollable List

Simon - Ah! perfect, hopefully that should increase the perfomance of scrolling. One other question, do you recommend that i use the ObjectListField as is, or extend the ListField class and create a custom ObjectListField? I guess some of the preconditions are obviously custom rows with dynamic web data, and also a custom onFocus background image.

 

Eugen - Whew! Luckily it is a requirement that all of my row items are the same height. But is there something else you would use if they weren't the same height?

Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Complex Scrollable List

I use objectlistfield in pretty much every application, thus i have written my own extension of the listfield class. It provides numerous advantages, for example allowing to add a vector, set a vector, customizing the focus color or retrieving the selected object. can't share the code of course, but it is not that hard to implement and easy to enhance if needed.

 

I would recommend that you take an hour or two and implement an objectlistfield as you want it, saves a lot of time later on.

 

As for the different heights: You could use the hidden setRowHeigt(index, height) method, but i would not recommend it.

Better to adjust the requirements :smileyhappy:

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
ksykulev
Posts: 58
Registered: ‎07-09-2009

Re: Complex Scrollable List

You sure you can't share it... :smileywink:

 

Thanks alot for your help. I appreciate it...

Please use plain text.