android - Show multiple images in a imageView one after another with left to right flip effect repeatedly -


suppose have multiple images in drawable folder(ex-8 images). want show these images in imageview 1 after left right flip effect repeatedly(ex-img[0],img[1],……img[8],img[0],img[1],…………). how can this?

private void animateandslideshow() {     image1 = (imageview)findviewbyid(r.id.imageview1);     image1.setimageresource(img[currentimageindex1%img.length]);     currentimageindex1++;     animation rotateimage = animationutils.loadanimation(this, r.anim.custom_anim);     image1.startanimation(rotateimage);          } 

use custom function rotate image using handler interval change image,here change image vice verse direction :

    private imageview image1;     private int[] imagearray;     private int currentindex;     private int startindex;     private int endindex;     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);          image1 = (imageview)findviewbyid(r.id.imageview1);         imagearray = new int[8];         imagearray[0] = r.drawable.one;         imagearray[1] = r.drawable.two;         imagearray[2] = r.drawable.three;         imagearray[3] = r.drawable.four;         imagearray[4] = r.drawable.five;         imagearray[5] = r.drawable.six;         imagearray[6] = r.drawable.seven;         imagearray[7] = r.drawable.eight;          startindex = 0;         endindex = 7;         nextimage();       }      public void nextimage(){         image1.setimageresource(imagearray[currentindex]);         animation rotateimage = animationutils.loadanimation(this, r.anim.custom_anim);         image1.startanimation(rotateimage);         currentindex++;         new handler().postdelayed(new runnable() {             @override             public void run() {                 if(currentindex>endindex){                     currentindex--;                     previousimage();                 }else{                     nextimage();                 }              }         },1000); // here 1000(1 second) interval change current  next image        }     public void previousimage(){         image1.setimageresource(imagearray[currentindex]);         animation rotateimage = animationutils.loadanimation(this, r.anim.custom_anim);         image1.startanimation(rotateimage);         currentindex--;         new handler().postdelayed(new runnable() {             @override             public void run() {                 if(currentindex<startindex){                     currentindex++;                     nextimage();                 }else{                     previousimage(); // here 1000(1 second) interval change current  previous image                  }             }         },1000);      } 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -