My application creates a playlist, using the following type declaration:
This is then used to create playlist items:
The PlayList is save to a file with:
Subsequently the list is then loaded again with:
When I try to access the individual list items, with:
I get this error:
Anyone suggest a way to get the contents of the PlayList please?
B4X:
Type PlayListItem(Artist As String, Album As String, Track As String)
This is then used to create playlist items:
B4X:
Dim pli As PlayListItem
pli.Initialize
pli.Track = CleanString(Value)
pli.Artist = CleanString(CurrPath.Get(0))
pli.Album = CleanString(CurrPath.Get(1))
PlayList.Add(pli)
The PlayList is save to a file with:
B4X:
File.WriteList( File.DirDefaultExternal, CurrentPL, PlayList)
Subsequently the list is then loaded again with:
B4X:
If fdlg.Show("Select Playlist","OK","Cancel","", LoadBitmap(File.DirAssets, "play-button-th.png")) = DialogResponse.POSITIVE Then
target = fdlg.ChosenName
PlayList.Clear
PlayList = File.ReadList( File.DirDefaultExternal, target)
imgPlayList_Click
End If
When I try to access the individual list items, with:
B4X:
For t = 0 To PlayList.Size - 1
Dim pli As PlayListItem
'pli.Initialize
pli = PlayList.Get(t)
lvPlayList.AddTwoLines2(pli.Artist & " : " & pli.Track, pli.Album, pli.Track)
Next
I get this error:
java.lang.ClassCastException: java.lang.String cannot be cast to remoteplayer.b4a.client$_playlistitem
Anyone suggest a way to get the contents of the PlayList please?