I'm developing a gallery app, in this app I'm displaying images in slideshow using gallery. It's working fine, but I want to add some animation. I can apply only one animation with this code but I want to add two animation effects in gallery view. Say in translation effect, right-to-center and center-to-left. Please anyone help me out.
public void slidShow(){
Runnable runnable = new Runnable() {
@Override
public void run() {
myslideshow();
handler.postDelayed(this, 3000);
}
};
new Thread(runnable).start();
}
private void myslideshow(){
PicPosition = gallery.getSelectedItemPosition() +1;
if (PicPosition >= bitmaps.size()){
PicPosition = gallery.getSelectedItemPosition(); //stop
}
else{
Animation inFromRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromRight.setDuration(500);
inFromRight.setInterpolator(new AccelerateInterpolator());
gallery.startAnimation(inFromRight);
gallery.setSelection(PicPosition);
}
}