Android Question fatal signal error Android 4.3

mcmanu

Active Member
Licensed User
Longtime User
When i Press the volume Button my app Chrashes with the Posted error (fatal signal)

my code is:

If KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN Then
Dim PhoneVol As Phone
Dim temp As Int
temp = PhoneVol .GetVolume(PhoneVol .VOLUME_MUSIC)
If temp > 0 Then
temp = temp - 1
PhoneVol .SetVolume(PhoneVol .VOLUME_MUSIC, temp, True)
End If
End If

If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
temp = PhoneVol .GetVolume(PhoneVol .VOLUME_MUSIC)
If temp < PhoneVol .GetMaxVolume(PhoneVol .VOLUME_MUSIC) Then
temp = temp + 1
PhoneVol .SetVolume(PhoneVol .VOLUME_MUSIC, temp, True)
End If
End If

Erel Posted a Workaround, but unfortunately it doesn´t work for me
Erels workaround covers only when the user closes the app with the backkey
--> http://www.b4x.com/android/forum/threads/android-4-3-pb-with-closing-the-app.31328/page-2

My other Problem is that i Use the Back key not only to close my application
For example i Set some Views/controls to Visible false when i press the backkey (when the views are visible true --> back key --> views visible false)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Are you running B4A v3.0? The workaround in that thread is not needed in this version.

I tried to reproduce the volume error with this code:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
   If KeyCode = KeyCodes.KEYCODE_VOLUME_DOWN Then
   Dim PhoneVol As Phone
   Dim temp As Int
   temp = PhoneVol .GetVolume(PhoneVol .VOLUME_MUSIC)
   If temp > 0 Then
   temp = temp - 1
   PhoneVol .SetVolume(PhoneVol .VOLUME_MUSIC, temp, True)
   End If
   End If

   If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
   temp = PhoneVol.GetVolume(PhoneVol.VOLUME_MUSIC)
   If temp < PhoneVol .GetMaxVolume(PhoneVol.VOLUME_MUSIC) Then
   temp = temp + 1
   PhoneVol .SetVolume(PhoneVol .VOLUME_MUSIC, temp, True)
   End If
   End If
End Sub

No error was raised.
 
Upvote 0

mcmanu

Active Member
Licensed User
Longtime User
Yes i Updated Basic4android to 3.0, but unfortunately my app crashes all the time because of the Volume function.
Mhh okay thats strange, but thank you for trying my code
Mhh i dont know why i am getting the fatal signal error, but i try to fix it and let you know.

Have you tried to change volume several times?

Edit: Sorry it was not the Volume Funktion, i implemented a Slidingmenue
And close it when its open and the user press the backkey.
Now i deleted this funktion, and now it works Perfectly

Thank you erel for testing my code
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…