Skip to content

Instantly share code, notes, and snippets.

Created September 29, 2016 18:20
Show Gist options
  • Save anonymous/39e359fe5672df1c3a8e0ebb578b4c37 to your computer and use it in GitHub Desktop.
Save anonymous/39e359fe5672df1c3a8e0ebb578b4c37 to your computer and use it in GitHub Desktop.
int size = pics_array.length;
/* this method called when the forward button clicked (for testing) */
public void go (View view) {
if (index < size - 1) {
index++;
default_Pic.setImageResource(pics_array[index]);
}else {
index = 0;
default_Pic.setImageResource(pics_array[index]);
}
}
/* this method called when the back button clicked (for testing) +++need fixing+++ */
public void back (View view) {
if (index <= 0) {
index = size - 1 ;
default_Pic.setImageResource(pics_array[index]);
}else {
index--;
default_Pic.setImageResource(pics_array[index]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment