9 99toLife Member Licensed User Longtime User Feb 8, 2012 #1 After searching the forum I haven't found a way to simulate a back/menu/search button click. For example, I want a button in the app that brings up the same menu that the menu button brings up. I hope this makes sense and someone might have a suggestion or two. :sign0163:
After searching the forum I haven't found a way to simulate a back/menu/search button click. For example, I want a button in the app that brings up the same menu that the menu button brings up. I hope this makes sense and someone might have a suggestion or two. :sign0163:
H hbruno Member Licensed User Longtime User Feb 8, 2012 #2 You can use : Code: Sub Activity_KeyPress(KeyCode As Int) As Boolean Dim Rep As Int Select KeyCode Case KeyCodes.KEYCODE_BACK ' --> Button "BACK" Case KeyCodes.KEYCODE_SEARCH ' --> Button "SEARCH" Case KeyCodes.KEYCODE_MENU ' --> Button "MENU" End Select End Sub And, in the program, when you want to simulate the Button SEARCH : Code: Activity_KeyPress(KeyCodes.KEYCODE_SEARCH) Upvote 0
You can use : Code: Sub Activity_KeyPress(KeyCode As Int) As Boolean Dim Rep As Int Select KeyCode Case KeyCodes.KEYCODE_BACK ' --> Button "BACK" Case KeyCodes.KEYCODE_SEARCH ' --> Button "SEARCH" Case KeyCodes.KEYCODE_MENU ' --> Button "MENU" End Select End Sub And, in the program, when you want to simulate the Button SEARCH : Code: Activity_KeyPress(KeyCodes.KEYCODE_SEARCH)
9 99toLife Member Licensed User Longtime User Feb 8, 2012 #3 Thanks for your help but I don't think I'm explaining it right. If I check for the menu button in Activity_KeyPress it will only consume it or not. What I want to do is invoke the menu that is shown by the menu button (without pressing the menu button). Returning true or false in Activity_KeyPress doesn't invoke it. Any other suggestions? Thanks again! Last edited: Feb 8, 2012 Upvote 0
Thanks for your help but I don't think I'm explaining it right. If I check for the menu button in Activity_KeyPress it will only consume it or not. What I want to do is invoke the menu that is shown by the menu button (without pressing the menu button). Returning true or false in Activity_KeyPress doesn't invoke it. Any other suggestions? Thanks again!
Ricky D Well-Known Member Licensed User Longtime User Feb 9, 2012 #5 Activity.Finish for a back press. But I don't know about the search... Upvote 0
9 99toLife Member Licensed User Longtime User Feb 10, 2012 #6 kickaha said: Activity.OpenMenu Click to expand... That's it! Thank you and thanks to hbruno and Ricky D too. :sign0060: Upvote 0
kickaha said: Activity.OpenMenu Click to expand... That's it! Thank you and thanks to hbruno and Ricky D too. :sign0060:
Ricky D Well-Known Member Licensed User Longtime User Feb 10, 2012 #7 mmm. I Just realised that if you want back key on say to get rid of keboard or anything else that pops up then my code won't work - it will close the entire activity. I'm not sure if that's what you want. regards, Ricky Upvote 0
mmm. I Just realised that if you want back key on say to get rid of keboard or anything else that pops up then my code won't work - it will close the entire activity. I'm not sure if that's what you want. regards, Ricky
9 99toLife Member Licensed User Longtime User Feb 10, 2012 #8 Ricky D said: mmm. I Just realised that if you want back key on say to get rid of keboard or anything else that pops up then my code won't work - it will close the entire activity. I'm not sure if that's what you want. regards, Ricky Click to expand... I wanted to programmatically open the menu that is opened from the menu button. I appreciate knowing about Activity.Finish though. Thanks! :icon_clap: Upvote 0
Ricky D said: mmm. I Just realised that if you want back key on say to get rid of keboard or anything else that pops up then my code won't work - it will close the entire activity. I'm not sure if that's what you want. regards, Ricky Click to expand... I wanted to programmatically open the menu that is opened from the menu button. I appreciate knowing about Activity.Finish though. Thanks! :icon_clap:
Ricky D Well-Known Member Licensed User Longtime User Feb 10, 2012 #9 Oh ok. So why do you to also do the Back key? To close the menu? If so there's a CloseMenu method. regards, Ricky Upvote 0
Oh ok. So why do you to also do the Back key? To close the menu? If so there's a CloseMenu method. regards, Ricky
9 99toLife Member Licensed User Longtime User Feb 10, 2012 #10 Ricky D said: Activity.Finish for a back press. But I don't know about the search... Click to expand... Activity.Finish is it! (I didn't see this post.) I forgot I needed all the soft menu items! So, thanks! Do you know how to invoke the search button? Upvote 0
Ricky D said: Activity.Finish for a back press. But I don't know about the search... Click to expand... Activity.Finish is it! (I didn't see this post.) I forgot I needed all the soft menu items! So, thanks! Do you know how to invoke the search button?