I know calling finish() in activity will produce same result as if user clicked on Back button; is there a similar thing for Home button? (would like to automatically show Home screen after certain action).
EDIT: Also, I would appreciate same thing for Menu & Search buttons.
Thanks!
These action are fully customizable - you can set swipe and tap duration, repeat interval, repeat count and randomize coordinates. You can see simulate Notch in Android Pie devices at the upper right corner side. You can extract .apk files via ADB.
To simulate a touch at specific screen coordinates from keyword tests, use the Device Touch operation: To simulate long press, swipe and drag actions in keyword tests, call the appropriate methods of the Device object by using the Call Object Method , … It just showed a black screen with no apparent progress.
Just to clarify what moonlightcheese stated: To trigger a button click event through code in Android provide the following: private Button btn; btn = (Button)findViewById (R.id.button2); btn.performClick (); where button is the reference variable of Button class and defined as follows:-
Android's callOnClick () ( added in API 15) can sometimes be a better choice in my experience than performClick (). If a user has selection sounds enabled, then performClick () could cause the user to hear two continuous selection sounds that are somewhat layered on top of each other which can be jarring.
You can simply use an Intent for that:
Intent i = new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
startActivity(i);
HOME:
Intent showOptions = new Intent(Intent.ACTION_MAIN); showOptions.addCategory(Intent.CATEGORY_HOME); startActivity(showOptions);
MENU:
openOptionsMenu(); // this won't work from onCreate // if anyone has idea how it would work // please post it as response
startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With