I'm creating an app on android for viewing the image when I select the next button to show the new image and the back button to show previous image but when the press the next button to the maximum index , i want it to show the start from first image index and when the press the back button to the minimum index, i want it to show the start from maxminum image index. I have problem when i click the back button go to 0 index i want it show the image from the final index and also when i click the next button go to final index i want it show the from the 0 index. *
if (v == btn_back) {
if((currentimageindex)!=0){
imageview.setImageResource(IMAGE_IDS[currentimageindex]);
mp = MediaPlayer.create(this, myMusic[currentsoundindex]);
mp.start();
--currentimageindex;
--currentsoundindex;
}
if((currentimageindex)==0){
imageview.setImageResource(IMAGE_IDS[currentimageindex]);
mp = MediaPlayer.create(this, myMusic[currentsoundindex]);
mp.start();
--currentimageindex;
--currentsoundindex;}
if(v== btn next){*******}