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: 
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
0 Kudos
3 REPLIES 3
destruk
Binge Watcher

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.
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
0 Kudos
destruk
Binge Watcher

Re: Is there a way to handle empty feed?

You're welcome.
0 Kudos