Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
joetesta
Roku Guru

Is there a way to handle empty feed?

I'm setting up a 'favorites' channel where users can add titles from other channels and they will show up in their favorites. I have it all working in the videoplayer example except for how to handle the case when they have no favorites. By default the user is left at a screen with a gray "Retrieving..." message.

In the showFeed.brs I was able to add a function called from load_show_feed, so that when "islist(xml.GetBody()) = false", a roMessageDialog is created with a message telling the user to add some favorites first.

The problem is that after that window exits, the user is left at a screen that simply says "Retrieving". I tried passing them back to the category screen with "displayCategoryPosterScreen" but it still drops them here.

Does anyone have any suggestions or ideas for how I could send them back to the category page in this situation?

tyvmia

ps, here is the function i tried to display the alert, called from 'load_show_feed'
Function alertFavorites() As Void
port = CreateObject("roMessagePort")
dialog = CreateObject("roMessageDialog")
dialog.SetMessagePort(port)
dialog.SetTitle("No Favorites Found")
dialog.SetText("Please add some titles to your favorites by visiting other categories first")
dialog.AddButton(1, "OK")
dialog.Show()
while true
dlgMsg = wait(0, dialog.GetMessagePort())
if type(dlgMsg) = "roMessageDialogEvent"
exit while
end if
end while
displayCategoryPosterScreen(0)
End Function
aspiring
Tags (1)
0 Kudos
3 REPLIES 3
destruk
Streaming Star

Re: Is there a way to handle empty feed?

How I deal with that is to provide it with a dummy entry called "empty" or "placeholder" and give it a poster to display, but have the wait routine for input check if the title of the selected item is something else before trying to play it. That way if someone tries to select the empty icon, nothing happens.
Alternately, you could simply have your code check for an empty feed before creating the screen to populate the content and toss up a dialog box saying there is nothing there.
Tags (1)
0 Kudos
joetesta
Roku Guru

Re: Is there a way to handle empty feed?

Thanks destruk!

I was able to get back to the category page with this:
screen=preShowHomeScreen("", "")
showHomeScreen(screen)

but then I found if i click up from there, i am still at the "Retrieving..." page

I'm going to try this next: "have your code check for an empty feed before creating the screen to populate the content and toss up a dialog box"

Update: got it working! thanks again destruk
aspiring
Tags (1)
0 Kudos
destruk
Streaming Star

Re: Is there a way to handle empty feed?

You're welcome.
Tags (1)
0 Kudos
Community is Temporarily in Read-Only Mode!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!