Yes the 1st code is wrong. The function expects that you return a boolean (there's "As boolean" at the end of the first line). So writing "return" only is not enough. A "Return True" or "Return False" is expected. "Return" alone returns an empty string so the interpretation by the code behind cannot be predicted (in this case, it interprets this empty string as False).
@Erel - The app doesn't crash but just goes back a screen (activity), it's like it ignores the code in that sub but if I write to the log when the back button is pressed (write to the log just before the return) it will log it. Looks like it ignores the 'return' in that sub.
@Informatix - I think you might be right, did notice the 2nd lot of code has 'return true' where my 1st lot of code doesn't have that.
<code>
Sub Activity_KeyPress(KeyCode As Int) As Boolean
Dim Answ As Int
If KeyCode=KeyCodes.KEYCODE_BACK Then
Answ=Msgbox2("Do you want to quit the program ?","A T T E N T I O N","Yes","","No",Null)
If Answ=DialogResponse.NEGATIVE Then
Return True
Else
Activity.Finish
Return False
End If
End If
End Sub
</code>
The above code works fine.
The issue discussed in the thread you linked was fixed in v3.00. It is a different issue. You should post your complete project (File - Export as zip).