I want to rotate
imageview
and then I want to start activity
onClick of imageview
but the problem is that android system doesn't give the time to complete the animation
and launching the activity. So how can I show the animation completely and then calling the activity.
This is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200"
android:fromDegrees="-7"
android:pivotX="50%"
android:pivotY="50%"
android:repeatMode="reverse"
android:toDegrees="7" />
And this code:
public void onImageViewClicked(View view){
switch(view.getId()){
case R.id.viewstock:
Animation shakeV = AnimationUtils.loadAnimation(this, R.anim.shake);
view.startAnimation(shakeV);
startActivityForResult(intent, 12);
break;
case R.id.about:
Animation shakeA = AnimationUtils.loadAnimation(this, R.anim.shake1);
view.startAnimation(shakeA);
Intent aboutIntent = new Intent(MainActivity.this,AboutActivity.class);
startActivity(aboutIntent);
break;
}
}
Yup, My guessing was right. Use for shakeA, shakeV
Can you provide your code snippet to support your question. So it would be much easier to know how you are handling the animation.
For now I will assume that you are using standard Animation. If that is the case use
Animation.AnimationListener
to listenonAnimationEnd(Animation animation)
. There you start your activity.For more check this.
Hope this will help you.