Settings page

splatt

Active Member
Licensed User
Longtime User
Is it possible to catch the Settings key being pressed whilst an Activity is running? I want to implement a settings page and want to keep theAndroid look & feel.
 

alfcen

Well-Known Member
Licensed User
Longtime User
Hi splatt

Perhaps this will do:

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
   If KeyCode = 82 Then ' Menu key
      StartActivity("settings")
      Return True
   End If
   If KeyCode = 4 Then ' Back Key
       i = Msgbox2("Exit Application?", "MyApp", "Yes", "", "No", bmpAppIcon)
       If i = DialogResponse.POSITIVE Then
             Activity.Finish
       End If 
   Return True
   End If
End Sub
 
Upvote 0

splatt

Active Member
Licensed User
Longtime User
Alfcen:sign0142:.

That looks like it might work.

Would I be right in assuming that we can simulate the effect seen on the Home screen for example, where pressing the Menu key could make a panel visible with ImageViews?
 
Upvote 0

alfcen

Well-Known Member
Licensed User
Longtime User
Yep, that could be done:

B4X:
If KeyCode = 82 Then ' Menu key
   Panel1.Visible = True   'your panel with ImageViews
   Return True
End If
 
Upvote 0
Top