java - How to stop incrementing and decrimenting at the end of an array? -
i'm beginner in programming. want make android app 3 views. text view (display text), , buttons (forward , back). i made array of words one, two, three, four, five displayed. put one on xml . when user clicks forward shows two when click forward again shows three , when user clicks back shows two . can until poit. the problem when reaches five , user clicks forward , when reaches one , user clicks back crashes. i want button nothing, not goes one . want user know end of list. same problem back button. want stays on one . code. please help. public class aba extends appcompatactivity { int = 0; string[] mylist = { "one", "two", "three", "four", "five" }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_aba); } //incremen...