Mar 4, 2012 Replies: 8 I have an app that opens web pages from a menu. Having trouble getting it to NOT close every time you click the android back button (drops out of app). Tried this code: Sub activity_KeyPress (KeyCode As Int) As Boolean If KeyCode = KeyCodes.KEYCODE_BACK Then WebView1.Visible = False ListView1.Visible = True End If End Sub Does not work, (listview1 is my main menu I want it to come back to) app still closes if you click the android back button. Does it have to go in some place special? Click to expand...
I have an app that opens web pages from a menu. Having trouble getting it to NOT close every time you click the android back button (drops out of app). Tried this code: Sub activity_KeyPress (KeyCode As Int) As Boolean If KeyCode = KeyCodes.KEYCODE_BACK Then WebView1.Visible = False ListView1.Visible = True End If End Sub Does not work, (listview1 is my main menu I want it to come back to) app still closes if you click the android back button. Does it have to go in some place special?
P Penko Active Member Licensed User Longtime User Mar 4, 2012 #2 You have to Return True in order to consume the event and thus keep the app running. For further reference check the official guide(written by Klaus): http://www.b4x.com/android/files/guide.zip You will find an example of exactly what you are looking for at the bottom of page 134. Last edited: Mar 4, 2012
You have to Return True in order to consume the event and thus keep the app running. For further reference check the official guide(written by Klaus): http://www.b4x.com/android/files/guide.zip You will find an example of exactly what you are looking for at the bottom of page 134.
S sheriffporter Member Licensed User Longtime User Mar 4, 2012 #3 That did it. Somehow missed that when I looked in the Guide. Thanks!
G GeorgeJ New Member Licensed User Longtime User May 8, 2012 #4 This is mentioned on pages 237 (16.1) and 308 (19.6) in the guide I have. I am currently studying this very helpful guide.
This is mentioned on pages 237 (16.1) and 308 (19.6) in the guide I have. I am currently studying this very helpful guide.
P pelican2 Member Licensed User Longtime User Jun 23, 2013 #5 I can't find the code in the docs contained in the link... I also have a need / desire to disable the BACK button... It appears the beginner's guide was updated 5/18/2013 to version 2.5... after these forum posts were created. A PDF search for keywords BACK BUTTON revealed no such code...:sign0085:
I can't find the code in the docs contained in the link... I also have a need / desire to disable the BACK button... It appears the beginner's guide was updated 5/18/2013 to version 2.5... after these forum posts were created. A PDF search for keywords BACK BUTTON revealed no such code...:sign0085:
Erel B4X founder Staff member Licensed User Longtime User Jun 23, 2013 #6 You can try these search results: Basic4android Search: BACK BUTTON
P pelican2 Member Licensed User Longtime User Jun 23, 2013 #7 Thanks, I found the answer elsewhere, tried it and it works... :sign0060:
klaus Expert Licensed User Longtime User Jun 23, 2013 #8 Beginner's Guide chapter 17.6 Avoid closing an application / capture keycodes like Back / Menu Best regards.
Beginner's Guide chapter 17.6 Avoid closing an application / capture keycodes like Back / Menu Best regards.
P pelican2 Member Licensed User Longtime User Jun 23, 2013 #9 That's where I found it... and it works... thanks.