i want to get the next item on an array on button click.
array is like this :
String[] pickupLinesItems = { "a", "b", "c" };
then i have this for the spinner
public void onItemSelected(org.holoeverywhere.widget.AdapterView<?> parent,
View view, int position, long id) {
position = spinner.getSelectedItemPosition();
SpinnerAdapter adap = spinner.getAdapter();
if (adap.equals(pickupLinesAdapter)) {
switch (position) {
case 0:
stopPlaying();
speakMedia = MediaPlayer.create(this, R.raw.a);
break;
case 1:
stopPlaying();
speakMedia = MediaPlayer.create(this, R.raw.b);
break;
case 2:
stopPlaying();
speakMedia = MediaPlayer.create(this, R.raw.c);
break;
}
}
}
public void onClick(View v) {
// TODO Auto-generated method stub
int index = 0;
switch (v.getId()) {
case R.id.next:
// here i want to go on the next item on array
break;
case R.id.back:
// here i wanna go back one item on the array
break;
}
}
how would i do this, i've tried everything and cant seem to get it. i tried to do an if statement but nothing.