I found that the actual parameter of the method is not an identifier, but an βindexβ when it matters. Therefore my way:
private void clickOnButtonByID(int ID) { // get a list of all ImageButtons on the current activity List<Button> btnList = solo.getCurrentButtons(); for (int i = 0; i < btnList.size(); i++) { Button btn = btnList.get(i); // find button by id if (btn.getId() == ID) { // click on the button using index (not id !!!) solo.clickOnButton(i); // check if new activity is the 'About' } else { // other code } } }
source share