Forked from anonymous/gist:39e359fe5672df1c3a8e0ebb578b4c37
Last active
October 4, 2016 22:27
-
-
Save basxto/2d8994788ff03499d7fee70095db9bc4 to your computer and use it in GitHub Desktop.
simplified and hopefully fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int last = pics_array.length - 1; | |
// this method gets called when the forward button got clicked (for testing) | |
public void go (View view) { | |
index++; | |
if(index > last)//out of bounds | |
index = 0;//jump to beginning | |
default_Pic.setImageResource(pics_array[index]); | |
} | |
// this method gets called when the back button got clicked (for testing) | |
public void back (View view) { | |
index--; | |
if(index < 0)//out of bounds | |
index = last;//jump to end | |
default_Pic.setImageResource(pics_array[index]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment