Appium and For loop

Please help me to write appium-java code for for loop in android app.I have a list of buttons in ListView and I want to click each button sequentially to open new screen. but I was stuck as I am new to Appium. Any help will be appreciated.