I have a textview where I load the 0 value by using textView.setText(nameofstory.next());
But when I go into the application and use the buttons to move left and right on the list I need to press it twice to get to the next/previous value
Any help please?
private List<String> nameofstory
nameofstorylist = new ArrayList<String>();
nameofstory.add("test");
nameofstory.add("tests");
nameofstory.add("test1s");
nameofstory.add("test2s");
ListIterator<String> nameofstory = nameofstorylist.listIterator();
textView.setText(nameofstorylist.get(0));
public void NextButton(View view) {
if (nameofstory.hasNext()){
textView.setText(nameofstory.next());
}
}
public void BackButton(View view) {
if (nameofstory.hasPrevious()){
textView.setText(nameofstory.previous());
}
}
and make sure that you are not using
onClickon your layout xml.