Would someone tell me what is causing a 'Not all code paths return a value'.
the _KeyPress Sub is not only for the Back Button. Its also for the Volume Button and for the Menu Button,...
so when you filter it and say if pressed button is the Back Button then do this but what will happen if its not the Back button??
so adding on the bottom "Return False" will clear that warning.
Sub Activity_KeyPress (key As Int) As Boolean
If key = KeyCodes.KEYCODE_BACK Then
If Searchview1. Visible=True Then
Searchview1.Visible=False
Panel1.Visible=True
Return True
Else
Return False
End If
End If
Return False '<----------
End Sub
Note that the KeyPressed sub is expecting a returned value (in our case a Boolean) so that value must be returned in any possible case otherwise its a sub that returns a value without really doing it in any scenario.