Is it possible that you have conditions (if statements) that would prevent a value being returned for the Sub, that you are only returning a value when a certain condition is met?
You can paste the code and let everyone have a look.
And its probably stating the obvious, but it is only a warning. If your code is doing what you want it to, its probably safe to ignore it.
Is working ok, did not show any error on prev b4a., only on upgrade to 2.70
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If MapPanel.Visible=True Then
Main.BringToFront
MapPanel.SendToBack
MapPanel.Visible=False
MapPanel.RemoveAllViews
Return True
End If
If Main.Visible=True Then
HomeScreen
Return True
End If
End If
End Sub
Your code should be the following, though I don't know if this is redundant:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If MapPanel.Visible=True Then
Main.BringToFront
MapPanel.SendToBack
MapPanel.Visible=False
MapPanel.RemoveAllViews
Return True
End If
If Main.Visible=True Then
HomeScreen
Return True
End If
End If
Return False
End Sub
You are missing a return value if the KeyCode is not KeyCodes.KEYCODE_BACK
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Then
If MapPanel.Visible=True Then
Main.BringToFront
MapPanel.SendToBack
MapPanel.Visible=False
MapPanel.RemoveAllViews
Return True
End If
If Main.Visible=True Then
HomeScreen
Return True
End If
End If
Return False ' You are missing this return value if the IF block above is not entered
End Sub