How to swipe an element from a list?

when i want to swipe an element to the right or to the left i have used
driver.findElement(By.name(“2”)).getLocation().move(-467.0, -74.0);
driver.findElement(By.name(“2”)).swipe(407, 705, -467.0, -74.0, 1);
But both are not working !
i’m using an AndroidDriver with the following set up :driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”),capabilities);