OK so I've tried:
And my program just crashes and i get an Andoid system error message
So then I tried to break it down with:
This does change the volume AND then crashes with the same Android system error message.
Any ideas what I'm doing wrong here?
B4X:
If KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN Then
If phoneData.GetVolume(phoneData.VOLUME_MUSIC) > 0 Then
phoneData.SetVolume(phoneData.VOLUME_MUSIC, phoneData.GetVolume(phoneData.VOLUME_MUSIC) - 1, True)
End If
End If
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
If phoneData.GetVolume(phoneData.VOLUME_MUSIC) < phoneData.GetMaxVolume(phoneData.VOLUME_MUSIC) Then
phoneData.SetVolume(phoneData.VOLUME_MUSIC, phoneData.GetVolume(phoneData.VOLUME_MUSIC) + 1, True)
End If
End If
And my program just crashes and i get an Andoid system error message
So then I tried to break it down with:
B4X:
dim temp as int
If KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN Then
temp = phoneData.GetVolume(phoneData.VOLUME_MUSIC)
If temp > 0 Then
temp = temp - 1
phoneData.SetVolume(phoneData.VOLUME_MUSIC, temp, True)
End If
End If
If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
temp = phoneData.GetVolume(phoneData.VOLUME_MUSIC)
If temp < phoneData.GetMaxVolume(phoneData.VOLUME_MUSIC) Then
temp = temp + 1
phoneData.SetVolume(phoneData.VOLUME_MUSIC, temp, True)
End If
End If
This does change the volume AND then crashes with the same Android system error message.
Any ideas what I'm doing wrong here?