Detecting Return Icon Click

heloman996

New Member
Licensed User
Longtime User
1. On my DROID I have the built in "Return, Menu, Home and Search" Icons. How do I detect the android "return" icon click?

Thanks,
Heloman
 

Inman

Well-Known Member
Licensed User
Longtime User
Return is actually the Back key. This is how you trap the Back key

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
   If KeyCode=KeyCodes.KEYCODE_BACK Then
      'Give statements to execute when Back key is pressed
      Return True
   End If
End Sub
 
Upvote 0

Libor

Member
Licensed User
Longtime User
Consume, Return, Void questions


Hi one follow up. What does consume the event actually mean? I've seen this in several postings. I'm just reading through the threads to get an idea what is possible and what is not as well as learn how to use B4A and find this confusing perhaps because I'm not a programmer.

Does it mean I just exit the event and go back to where it was called from and since I'm returning true it appears that the event completed? Or am I not understanding this correctly.

I see that the following in the help:

KEYWORDS

Return

Method

Returns from the current sub and optionally returns the given value.
Syntax: Return [value]

Returns : Void

Unfortunately I don't really understand what that means.

I have also seen Void all over the place but not been able to get a clear understanding of what that means.

thanks

Libor
 
Upvote 0

Libor

Member
Licensed User
Longtime User
Hi Erel, thanks. That actually clears a bit of it up for me and explains why some other functions I created were not working the way I wanted.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…