Switch window in android chrome using appium not working

I am trying to convert a working selenium web automated testing to android automated testing. However, I encountered problem in switching to new window. There are two open window after the automated link clicked but when after doing the driver.switchTo().window(currentHandle), I’m still getting the url and title of the first window even though the window handle’s name is changing from CDwindow-0 TO CDwindow-1. Is my method of switching correct?

private WebDriver androidTest() {

//Set the Desired Capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "My Phone");
caps.setCapability("udid", "521094ceea16c35f");
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "6.0.1");
caps.setCapability("browserName", "Chrome");
caps.setCapability("appPackage", "com.android.chrome");
caps.setCapability("noReset", true);

WebDriver driver = null;
try {
    driver = new AndroidDriver<MobileElement>(new      URL(""), caps);

} catch (MalformedURLException e) {

logger.debug("==== WebDriver Capabilities ====", new Object[0]);
logger.debug("Browser Name = {0}", new Object[] { caps.getBrowserName() });
logger.debug("Version = {0}", new Object[] { caps.getVersion() });

return driver;


public String switchToNewWindow(WebDriver driver){
        String currentHandle=null;                
        System.out.println("windowH"+  driver.getWindowHandles());
        for (String handle : driver.getWindowHandles()) {
              System.out.println("url :" + driver.getCurrentUrl() + handle);
                     currentHandle = handle;
                     System.out.println("url :" + driver.getCurrentUrl() + handle);

return currentHandle;