Android+Appium+Sliders from x to y

Problem: I have a slider in my app, where i can slide from x to y to set a price range ex: i need to set car price from 10K to 80K Now i need to set that value using appium for android

I am able to partially do it by just setting one particular value like below

MobileElement a11 = Mobiledriver.findElement(By.id(“values_rb”));
a11.setValue(“0.5”);

The above code will set to 50%

I also tried doing it other way around like below: But no luck

MobileElement a11 = Mobiledriver.findElement(By.id(“values_rb”));
int startx = a11.getLocation().getX();
int endy = a11.getLocation().getY();
int widthnow = a11.getSize().getWidth();
System.out.println(startx +" "+ endy);
TouchAction action = new TouchAction(Mobiledriver);
int moveto1 = (int) (widthnow*0.4);
action.press(startx, endy).moveTo(moveto1,endy).release().perform();