androidanimationandroid-emulator

Animation is not working in Emulater


i am enable to load animation in Emulater..Its working fine with any real device..

public class MainActivity extends Activity {

    private ImageView imgView;
    private Animation animation;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.grow);
        animation.setRepeatCount(50); // Repeat animation infinitely
        animation.setRepeatMode(Animation.REVERSE); 

        imgView = (ImageView) findViewById(R.id.imgView);
        imgView.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub


                imgView.startAnimation(animation);      



                new Handler().postDelayed(new Runnable() {
                    public void run() {

                        Intent it = new Intent(getApplicationContext(), MyWebView.class);
                        startActivity(it);

                    }
                }, 5000);


            }
        });
    }

and my anim xml file is following

<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
            android:fromDegrees="0"
            android:toDegrees="360"
            android:pivotX="50%"
            android:pivotY="50%"
            android:duration="50" />

Solution

  • I think you Might have Disabled Animations in Emulator: Check that:

    Settings>Display>Animation..

    Hope that helps your Problem