Question

I need to create an animation in android,i have one fixed image in the screen, i need to add another image over the previous image using fade in and out.

i have searched and i found something like this

Fade in and out in java

That is the concept, but can i add different image using this method,i have tried simple animation technique also but that is working in every version.

Could somebody help me @Thanks

Was it helpful?

Solution

try this:

public class MyAnimationListener implements AnimationListener {

    @Override
    public void onAnimationEnd(Animation animation) {
        // TODO Auto-generated method stub

        i.setImageResource(R.drawable.bg);
        i.startAnimation(animo);

    }

    @Override
    public void onAnimationRepeat(Animation animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationStart(Animation animation) {
        // TODO Auto-generated method stub

    }

}

In Second Activity:

MyAnimationListener mListener = new MyAnimationListener();
        anim.setAnimationListener(mListener);
        i.startAnimation(anim);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top