How to pick the first image from gallery by using index

How to pick the first image from gallery by using index.

I have tried with

driver.find_element_by_android_uiautomator(‘index(14)’).click()

This code is working with non-Zero index images. if I wanted to select the first image I need to use Zero but the code is no allowing me to select the 0 index and it is clicking on the entire screen…

Please take the list of images into List of xpath and then try giving index

Like @Boney said you need something: e.g. with finding list by id
driver.findElements(MobileBy.id( “id”)).get(0).click()

driver.findElements(By.xpath("//android.view.View[@index=1]"))

@Boney @Aleksei @upendraupadhyay Thanks for the response will try and let you know the status…