I have created 2 xml files:
res/xml/comedy.xml
<comedy>
<item title="Grown Ups" length="90min"/>
<item title="Grown Ups 2" length="90min"/>
<item title="Scary Movie" length="90min"/>
<item title="Superbad" length="90min"/>
<item title="Zoolander" length="90min"/>
<item title="Groundhog Day" length="90min"/>
<item title="Beverly Hills Cop" length="90min"/>
<item title="Beverly Hills Cop II" length="90min"/>
<item title="Hangover" length="90min"/>
<item title="Anchorman" length="90min"/>
<item title="Pineapple Express" length="90min"/>
<item title="Happy Gilmore" length="90min"/>
<item title="We're the Millers" length="90min"/>
<item title="Horrible Bosses" length="90min"/>
<item title="Horrible Bosses 2" length="90min"/>
<item title="Meet the Parents" length="90min"/>
res/xml/action.xml
<action>
<item title="Man in Black" length="90min"/>
<item title="Man in Black II" length="90min"/>
<item title="Man in Black III" length="90min"/>
<item title="Mission: Impossible" length="90min"/>
<item title="Mission: Impossible II" length="90min"/>
<item title="Mission: Impossible - The Phantom Pain" length="90min"/>
<item title="Terminator" length="90min"/>
<item title="Die Hard" length="90min"/>
<item title="Back to the Future" length="90min"/>
<item title="The Bourne Identity" length="90min"/>
<item title="Marvel's The Avengers" length="90min"/>
<item title="Jurassic Park" length="90min"/>
<item title="Jurassic World" length="90min"/>
<item title="The Dark Night" length="90min"/>
<item title="The Matrix" length="90min"/>
<item title="Kill Bill - Volume 2" length="90min"/>
<item title="Apocalypto" length="90min"/>
<item title="Apocalypse Now" length="90min"/>
<item title="Aliens" length="90min"/>
Now I want to pull a random movie out of each of these files.
Is there a way I can do that directly? Or do I have to pull all items out with XmlPullParser
(like here) and then use the Random Generator?
Side notes
1: I'm not entirely sure if the way I made those xml
files is ideal. I just oriented myself on the sample in the link. If you have better ideas, please tell me.
2: The end goal is to display a random movie in an app after the user selected one or more genres.