/** * Types text in an {@code EditText} * * @param index the index of the {@code EditText} * @param text the text that should be typed */ public void typeText(final EditText editText, final String text) { if (editText != null) { inst.runOnMainSync( new Runnable() { public void run() { editText.setInputType(InputType.TYPE_NULL); } }); clicker.clickOnScreen(editText, false, 0); activityUtils.hideSoftKeyboard(editText, true, true); boolean successfull = false; int retry = 0; while (!successfull && retry < 10) { try { inst.sendStringSync(text); successfull = true; } catch (SecurityException e) { activityUtils.hideSoftKeyboard(editText, true, true); retry++; } } if (!successfull) { Assert.assertTrue("Text can not be typed!", false); } } }