Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Infinite GetContent() Calls in SGDEX ContentHandler for DetailsView

I’m developing an application using SGDEX components and have successfully loaded content into a GridView. When a user selects an item, I switch to a DetailsView to show more information. I use a custom ContentHandler to fetch the details from my API.

My problem is that the GetContent() function in my ContentHandler is being called infinitely, leading to my Roku device crashing. The content loads correctly the first time, but the repeated calls eventually overload the device, and it crashes.

Any help or suggestions on how to resolve this would be greatly appreciated.


DetailsViewLogic.brs

function ShowDetailsView(rowContent as object, index as integer, isContentList = true as boolean) as object
    details = CreateObject("roSGNode", "DetailsView")

    content = CreateObject("roSGNode", "ContentNode")

    content.AddFields({
        HandlerConfigDetails: {
            name: "ContentHandlerDetail"
        },
        item: rowContent.GetChild(index)
        isContentLoaded: false
    })

    details.ObserveField("currentItem", "OnDetailsContentSet")
    details.ObserveField("buttonSelected", "OnButtonSelected")
    details.SetFields({
        content: content
        isContentList: true
        contentManagerType: "details"
    })

    m.top.ComponentController.CallFunc("show", {
        view: details
    })
    return details
end function


ContentHandlerDetail.brs

sub GetContent()
    print "ContentHandlerDetail.brs GetContent() was called"
    ' Redacted
    ' ...
end sub

Output from console

SGDEX: create new view: DetailsView
SGDEX: View Manager runProcedure addView
SGDEX: newView.setFocus(true)
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called
ContentHandlerDetail.brs GetContent() was called

 

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.