Cannot click the element after swipe in appium (android)

I tested on Amazon shopping app. I have an issue after swipe to find an element. Because the list view is too long. I need to scroll (using the swipe API). But after I swipe, I cannot click the element anymore. It returned no error but the app have no responses.

The function ScrollToElement() is to swipe to search element. I tried to use touch action tap but no hope. I tried to tap an exact(372,466) location and it works but it is not as expected. Thanks in advance.


public class FirstTest {
   private AppiumDriver driver;
   private   Dimension size;

   public void Setup() throws MalformedURLException {

      String appActivityText = "";

      String appPackageText = "";

      String fileLocation = "/system/app/";

      File classpathRoot = new File(System.getProperty("user.dir"));
      File appDir = new File(classpathRoot, "\\STC");
      File app = new File(appDir, fileLocation);
      DesiredCapabilities capabilities = new DesiredCapabilities();

      capabilities.setCapability("device", "Android");
      capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");

      capabilities.setCapability(CapabilityType.PLATFORM, "Android");

      capabilities.setCapability(CapabilityType.VERSION, "4.4.2");

      capabilities.setCapability("deviceName", "420373d0de528100");//420373d0de528100 01a61316598f30e6

      capabilities.setCapability("newCommandTimeout", "100");

      // capabilities.setCapability("app", "Chrome"/*app.getAbsolutePath()*/);

      capabilities.setCapability("appPackage", appPackageText);

      capabilities.setCapability("appActivity", appActivityText);

      driver = new AndroidDriver(new URL(""), capabilities);
      driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);


   public void Login() throws Exception {
      // Click on Shop by Deparment link
      driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
      System.out.println("Click on Shop by Deparment link");

      WebElement element = driver.findElement("Office Products Link"));
      ScrollToElement(driver, element);

//      TouchAction action = new TouchAction(driver);
//      action.tap(372,466).perform();

      driver.findElement("Office Products Link")).click();

   public void closeApp() {
      // driver.closeApp();


public static void ScrollToElement(AppiumDriver driver, WebElement element){
      size = driver.manage().window().getSize();

      // Find swipe start and end point from screen's with and height.
      // Find starty point which is at bottom side of screen.
      int start = (int) (size.height * 0.20);
      int starty = (int) (size.height * 0.80);
      // Find endy point which is at top side of screen.
      int endy = (int) (size.height * 0.20);
      // Find horizontal point where you wants to swipe. It is in middle of
      // screen width.
      int startx = size.width / 2;

      while (true) {
         driver.swipe(startx, starty, startx, endy, 3000);
         start = start + (starty - endy);
         if (element.getLocation().getY() - start < size.height - endy) {