Not able to perform scroll in android application

Hi Guys,
Since Touch actions class is deprecated, and most other solutions using MobileBy.AndroidUIAutomator seems to be deprecated as well… Can you please provide me a solution on how to scroll in android application using java.

Code which I used where MobileBy.AndroidUIAutomator shows as depricated:

String text1 = “Register User (verify)”;
WebElement registerbtn = (WebElement) driver.findElement(
MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().”

  • “textContains(”“+text1+”“))”));
    registerbtn.click();

Touch actions which is also deprecated:

TouchActions action = new TouchActions(driver);
action.scroll(element, X, Y);
action.perform();

I have also tried using keyboards actions down it works fine, But it would be better If I get solutions to perform scroll actions…

Thanks in advance.