Klaus, if you are still reading this. The code isn't working!
Everything is displaying correctly, except the text for each button isn't displaying. Also, when I click on the buttons I receive a java run time error and it pauses the program on that line.
Here is my complete code for your examination:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim mp As MediaPlayer
Dim svcButtons As ScrollView
Dim btnTest(13) As Button
Dim btnWidth = 150dip As Int
Dim btnHeight = 60dip As Int
Dim btnSpace As Int
'Dim ImageView1 As ImageView
Dim btnName(13) As String
End Sub
'button text
Sub Init
btnName(0) = "fun problem"
btnName(1) = "stupid #"
btnName(2) = "Jesus God"
btnName(3) = "finish"
btnName(4) = "aliens"
btnName(5) = "wall"
btnName(6) = "heart"
btnName(7) = "little activity"
btnName(8) = "hit that"
btnName(9) = "idiot"
btnName(10) = "mexicans"
btnName(11) = "political bs"
btnName(12) = "wacko"
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
mp.Initialize
Activity.LoadLayout("first")
'ImageView1.Initialize("bob.jpg")
svcButtons.Initialize(100)
'Activity.AddView(ImageView1, 30dip, 10dip, 260dip, 170dip)
Activity.AddView(svcButtons, 0, 0, 100%x, 100%y)
Dim i As Int
btnSpace = btnHeight / 2 + 1dip
For i = 0 To 12
If i Mod 2=0 Then
btnTest(i).Initialize("btnTest")
svcButtons.Panel.AddView(btnTest(i), 10dip, 190dip + i * btnSpace, btnWidth, btnHeight)
Else
btnTest(i).Initialize("btnTest")
svcButtons.Panel.AddView(btnTest(i), 160dip, 190dip + (i-1) * btnSpace, btnWidth, btnHeight)
End If
btnTest(i).Text = btnName(i)
btnTest(i).Tag = i
Next
svcButtons.Panel.Height = 10dip + i * btnSpace
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'Sound Clips
Sub btnTest_Click
Dim btn As Button
mp.Load(File.DirAssets, btn.Tag & ".wav")
mp.Play
End Sub