Scrolling issue in appium

Hi Everyone

I am using appium 1.7.2 and i am trying to scroll to particular text and then click the specified text when it is found but in my code it is scrolling till the bottom and after that nothing happens

Can anyone please help me with it

Code:

MobileElement element = (MobileElement) driver.findElement(MobileBy.AndroidUIAutomator(
“new UiScrollable(new UiSelector().className(“android.view.View”)).scrollIntoView(”
+ “new UiSelector().text(”+20+"));"));
element.click();

first method - m using this method to get into middle of the form , if there is no static text and content desc given to the element i want to click then i call the normal method to click …

                                                  try {
							TouchAction action = new TouchAction(driver);
							PointOption p1= new PointOption();
							Dimension dimensions = driver.manage().window().getSize();
							Double screenHeightStart = dimensions.getHeight() * 0.5;
							int h1 = screenHeightStart.intValue();
							Double screenHeightEnd = dimensions.getHeight() * 0.2;
							int h2 = screenHeightEnd.intValue();
							action.press(p1.point(0, h1)).moveTo(p1.point(0,-h2)).release().perform();
						      } catch (Exception e) {
							
							 System.out.println(e);
							 
							 System.out.println("scroll not done");
							 }
					//1	
						long timeoutInSeconds56 = 200;
						new WebDriverWait(driver, timeoutInSeconds56).until(ExpectedConditions.visibilityOfElementLocated(
							By.xpath("//android.view.View[@resource-id='x_1']"))).click();
						
						System.out.println("clicked on the first product");       

second method - this method i use to reach at the end of form - flingToEnd(1) - the int will decide how many time you want “fling” action to happen

driver.findElement(MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().scrollable(true).instance(0)).flingToEnd(1)”));;

there are some more methods if you wanna check out then - https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable

The second method works for me thank you