Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
jaxim
Level 7

Lazy Loading of Rowlist items

Is there a way to lazy load thumbnail images when they get into view? Is there a way to unload these same images once they get out of view?

There is mention of lazy loading on the following page, but I am unsure what needs to be done in order to accomplish this feature. Is this just for GridView or can RowList use lazyLoading? 

https://sdkdocs.roku.com/display/sdkdoc ... s-GridView
0 Kudos
3 Replies
jaxim
Level 7

Re: Lazy Loading of Rowlist items

UPDATE: I have not found a way to lazy load an item in a RowList yet. Has anyone figured out how to do this?

Also, let me define what I mean by lazy loading in case others define it differently.
Lazy Loading = loading a thumbnail image only when it is visible to the user. So as I scroll the rowlist to the right, each of the images of the thumbnails that were not visible should load once they become visible.
0 Kudos
BVatBBOD
Level 7

Re: Lazy Loading of Rowlist items

I do this in my app.

I simply start the grid with a ContentNode with a few (~30) sub ContentNode's.  On each item focus, I check to see how far they are down the list.  When they get (say 75%) down the list I trigger a task that then fetches the next 30 items.  As soon as the task returns them, I append those as ContentNode's to the grid's ContentNode.  I don't really worry about "unloading" the images as I believe Roku will handle unloading images as they go out of view (and in my experience it will).

Let me know if any of that is unclear. Also hit me up on Roku Dev Slack for more realtime discussion. (link in my sig)
Join the Roku Developers Slack Workspace for quicker help and great dev collaboration: http://tiny.cc/nrdf0y
0 Kudos
jaxim
Level 7

Re: Lazy Loading of Rowlist items

BVatBBOD, I will try that. I was hoping there would be an event to which the item could listen to know if it were visible, but I guess I will need to  do this outside of the RowList and hardcode that the fact that only 5 thumbnails (in my case) can be seen at any one time.

Thanks for the tip on the Slack channel, I'll be sure to subscribe! 
0 Kudos