Hello, in my case, i've tested everything out but nothing worked, i finally manage to get it work using the following code:
Dimension dimensions = driver.manage().window().getSize();
// Assumes that the button "done" of the keyboard is always in the bottom right corner of the screen
int x=dimensions.getWidth()-5;
int y=dimensions.getHeight()-5;
StringBuilder sb=new StringBuilder();
sb.append("adb shell input tap ").append(x).append(" ").append(y);
Process result = Runtime.getRuntime().exec(sb.toString());
This code is to be used only when there is no other "clean" solution
Hope it helps