Hold down and creating market on the map

We have a map display application and I need to hold down on the map to make a marker. I am using click() and it does not seem to work.
Any ideas?

Thank you!

Please check TouchAction:

http://appium.github.io/java-client/io/appium/java_client/TouchAction.html

You have longpress(…) method that will help you

Thank you.

This is my code and it’s stuck at last line. It is suppose to press buttonsighting, last line the text box comes up then long press on the map to make marker then enter “test” in the text box… Not sure what I am doing wrong here.

     driver.findElementById("com.salientfed.maptest2:id/buttonSighting").click(); 
	
	TouchAction action = new TouchAction(null);
	WebElement webElement = null;
	action.longPress(webElement).release().perform();
	//driver.findElementByClassName("android.widget.LinearLayout").click(); 
	
	driver.findElementByClassName("android.widget.EditText").sendKeys("test");

?? null. Shouldn’t it be your driver like:

TouchAction touchAction=new TouchAction(driver);
touchAction.longPress(element).perform();

Hmmm

So I fixed it but still no marker, thanks:

TouchAction action = new TouchAction(driver);
WebElement webElement = (WebElement) driver;
action.longPress(webElement).release().perform();

your webElement is also null.

WebElement element=driver.findElement(By.id("element_id"));
TouchAction touchAction=new TouchAction(driver);
touchAction.longPress(element).perform();

if it doesn’t work, maybe give a duration in ms:

touchAction.longPress(element,3000).perform();

My goodness, it worked!!! Thank you so much!
I am new to Appium as well as Java… Trying to learn…

Thank you again!