The next step is adding the selected values. In most cases you will want this to be the last saved selections. We can retrieve these values because they are saved for each filter every time a save action occurs on the container. The PodLoader class provides a getPodFilterById(...) which will return the selected values for each Pod filter.
031 Node genreSelectionNode = 032 getPodFilterById(PODTYPE.MYFAVMOVIES, "genre", document); 033 034 // Convert the Node to an ArrayList. 035 ArrayList<String> selectedGenres = 036 PodFilter.convertSelectionsNodeToArrayList(genreSelectionNode); 037 038 // Create a default genre selection. 039 if (selectedGenres.isEmpty()){ 040 selectedGenres.add("all"); 041 } 042 choices.addSelection(selectedGenres.get(0));
On line 32 we use the getPodFiltersById(...) method to return the saved selections for the 'genre' filter on the 'MYFAVMOVIES' Pod. The values are returned as a Node object in the raw format that they were encoded and stored as. The PodFilter.converSelectionsNodeToArrayList(Node) utility is used to convert the values into a list of String values. On line 42 we add the selected value, in this case it is the only value returned in the array.