Code example for ImageSwitcher

Methods: setImageResource, setInAnimation, setOutAnimation

0
        position += 1;
        if (position >= images.length) {
            position = 0;
        } 
        // AnimationHelperは個人のライブラリです。あしからず。 
        mSwitcher.setInAnimation(AnimationHelper.inFromRightAnimation());
        mSwitcher.setOutAnimation(AnimationHelper.outToLeftAnimation());
        mSwitcher.setImageResource(images[position]);
    } 
 
    private void showPrevious() { 
        position -= 1;
        if (position < 0) {
            position = images.length - 1;
        } 
        // AnimationHelperは個人のライブラリです。あしからず。 
        mSwitcher.setInAnimation(AnimationHelper.inFromLeftAnimation());
        mSwitcher.setOutAnimation(AnimationHelper.outToRightAnimation());
        mSwitcher.setImageResource(images[position]);
    }