Listview to MediaPlayerstream
Check the attached simple project, also, read this to learn more about
ListView
Hi NJDude,
I'm new to Basic4Android but your sample listview inspired something I would like to try.
Although, Instead of going from a ListView to web.openbrowser,
I was hoping to stay on the listview page and just play the mp3s as a stream in the background.
I got this far and don't know where to go from here...
Can you help??
Thanks in advance
Mike
Sub Process_Globals
Dim mp As MediaPlayerStream
End Sub
.....
Sub Globals
Dim web As PhoneIntents
Dim ListView1 As ListView
End Sub
......
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
If FirstTime Then
mp.Initialize("mp")
End If
ListView1.AddTwoLinesAndBitmap2("Free", "Dancing in the Garden", LoadBitmap(File.DirAssets,"dancing.jpg"),"http://www.michaeljohnson.com.au/samples-mobi/song1-1.mp3")
ListView1.AddTwoLinesAndBitmap2("Chill", "Dancing in the Garden", LoadBitmap(File.DirAssets,"dancing.jpg"),"http://www.michaeljohnson.com.au/samples-mobi/song1-2.mp3")
ListView1.AddTwoLinesAndBitmap2("Breath", "Dancing in the Garden", LoadBitmap(File.DirAssets,"dancing.jpg"),"http://www.michaeljohnson.com.au/samples-mobi/song1-3.mp3")
ListView1.AddTwoLinesAndBitmap2("Bridge", "Dancing in the Garden", LoadBitmap(File.DirAssets,"dancing.jpg"),"http://www.michaeljohnson.com.au/samples-mobi/song1-4.mp3")
ListView1.AddTwoLinesAndBitmap2("Swan", "Dancing in the Garden", LoadBitmap(File.DirAssets,"dancing.jpg"),"http://www.michaeljohnson.com.au/samples-mobi/song1-5.mp3")
ListView1.AddTwoLinesAndBitmap2("Roar", "Dancing in the Garden", LoadBitmap(File.DirAssets,"dancing.jpg"),"http://www.michaeljohnson.com.au/samples-mobi/song1-6.mp3")
ListView1.AddTwoLinesAndBitmap2("Forest", "Dancing in the Garden", LoadBitmap(File.DirAssets,"dancing.jpg"),"http://www.michaeljohnson.com.au/samples-mobi/song1-7.mp3")
ListView1.AddTwoLinesAndBitmap2("Labyrinth", "Dancing in the Garden", LoadBitmap(File.DirAssets,"dancing.jpg"),"http://www.michaeljohnson.com.au/samples-mobi/song1-8.mp3")
End Sub
........
Sub Listview1_ItemClick (Position As Int, Value As MediaPlayerStream)
mp.Load
'THIS IS WHERE I"M STUCK AS FAR AS CALLING THE STREAMER FROM THE LISTVIEW
End Sub
..........
Sub mp_StreamReady
Log("starts playing")
mp.Play
End Sub
......
Sub mp_StreamError (ErrorCode As String, ExtraData As Int)
Log("Error: " & ErrorCode & ", " & ExtraData)
ToastMessageShow("Error: " & ErrorCode & ", " & ExtraData, True)
End Sub
.....
Sub mp_StreamBuffer(Percentage As Int)
Log(Percentage)
End Sub