Need a code to Press and Hold

I am trying to insert a code that pressed and held my button down. This is the code I have right now but I am having a error in my code.

    WebElement redButtonElement = driver.findElementByAccessibilityId(redButton);
    TouchActions action = new TouchActions(driver);
    action.longPress(driver.findElement(By.id(redButtonElement)).perform()); 

My error is with “redButtonElement” and the error says
Java: incompatible types: org.openqa.selenium.WebElement cannot be converted to java.lang.String

Any other solutions for me to try?

action.longPress(driver.findElement(By.id(redButtonElement)).perform());
Here redButtonElement is a WebeEement whereas the method expects the ID as string

Ohh so should I enter it as the string ID, but if I do it that way “perform());” turns red.