HashMap<String, Integer> keyObj = new HashMap<String, Integer>();
keyObj.put("keycode", 26);
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("mobile:keyevent",keyObj);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
js.executeScript("mobile:keyevent",keyObj);
keyObj.remove(26);
keyObj.put("keycode", 1);
js.executeScript("mobile:keyevent",keyObj);