You are all welcome to join our new Facebook page: https://www.b4x.com/android/forum/threads/new-facebook-group.167607
Any help is appreciated.
What have you tried !
If the example adds ImageViews replace these by Buttons.
Otherwise you could post your project as a zip file (IDE menu File / Export As Zip).
Best regards.
Do you have big images ?
Attached a very simple example.
Best regards.
btnTest(i).Text = "Test " & i
btnTest(i).Tag = i
Sub Activity_Create(FirstTime As Boolean)
svcButtons.Initialize(100)
Activity.AddView(svcButtons, 0, 0, 100%x, 100%y)
Dim i, j As Int
btnSpaceX = btnWidth + 10dip
btnSpaceY = btnHeight + 1dip
For i = 0 To 19
btnTest(i).Initialize("btnTest")
j = i / 2
svcButtons.Panel.AddView(btnTest(i), 10dip + (i Mod 2) * btnSpaceX, 10dip + j * btnSpaceY, btnWidth, btnHeight)
btnTest(i).Text = "Test " & i
btnTest(i).Tag = i
Next
j = (i + 1) / 2
svcButtons.Panel.Height = 10dip + j * btnSpaceY
End Sub
Sub btnTest_Click
Dim btn As Button
btn = Sender
mp.Load(File.DirAssets, btn.Tag & ".wav")
mp.Play
End Sub
2. How do you create a list of strings that you could access with the same index in order to display different text on each button (as seen in the above picture)?
Dim btnName(20) As String
Dim wavName(20) As String
Sub Init
btnName(0) = "xxxx"
btnName(1) = "xxxy"
btnName(2) = "xxyy"
.
wavName(0) = "yyyy.wav"
wavName(1) = "yyyz.wav"
wavName(2) = "yyzz.wav"
.
End Sub
btnTest(i).Text = btnName(i)
Sub btnTest_Click
Dim btn As Button
btn = Sender
mp.Load(File.DirAssets, wavName(btn.Tag))
mp.Play
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?