Scrolling is not working in a page opened within a page in appium

scrolling is working fine in normal pages in android application.But if i click on any element it will open as a new page over existing page,there scrolling is not working in appium automation using touchaction.here is my code to scrolldown

public void scrollDown(AppiumDriver driver){
try {
int height = driver.manage().window().getSize().getHeight();
TouchAction touchAction = new TouchAction(driver);
touchAction.longPress(5, height * 2 / 3).moveTo(5, height / 3).release().perform();
}
catch(Exception e) {
e.getMessage();
}
}

Here is my code using AndroidDriver:

public void scrollUpManually() {
    Dimension size = driver.manage().window().getSize();
    int starty = (int) (size.height * 0.40);
    int endy = (int) (size.height * 0.90);
    int startx = size.width / 2;

    driver.swipe(startx, starty, startx, endy, 1000);
}

public void scrollDownManually() {
    Dimension size = driver.manage().window().getSize();
    int starty = (int) (size.height * 0.80);
    int endy = (int) (size.height * 0.20);
    int startx = size.width / 2;

    driver.swipe(startx, starty, startx, endy, 1000);
}

Driver.swipe is deprecated.its no longer available iam using java-client 6.0.0
so touch action is recomented