Hello. There are Options Menu with various elements. How can I programmatically click on one of them? Thank you in advance for your response.

    1 answer 1

    You can call the onOptionsItemSelected(menu.findItem(R.id.your_id_action)); method onOptionsItemSelected(menu.findItem(R.id.your_id_action)); while the menu should be a global variable that is initialized when creating the menu, but you can make it easier to put all the code in a separate method and call it at the right time