I am trying to make my application transition to the MenuActivity(main
menu) and the end the SplashActivity(splash screen) once the fade2
animation has finished, but instead of this happening my app force
closes after the SplashActivity ends. I think that my error lies in
the "onAnimationStart" and "onAnimationRepeat" lines but I am unsure.
What can I fix in my code?
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;
import android.widget.TextView;
public class SplashActivity extends Activity {
TextView maker, motto;
ImageView ball;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
maker = (TextView)findViewById(R.id.dev);
Animation fade1 = AnimationUtils.loadAnimation(this,
R.anim.fade_in);
maker.startAnimation(fade1);
ball = (ImageView)findViewById(R.id.Ball);
Animation customAnim = AnimationUtils.loadAnimation(this,
R.anim.custom_anim);
ball.startAnimation(customAnim);
motto = (TextView)findViewById(R.id.motto);
Animation fade2 = AnimationUtils.loadAnimation(this,
R.anim.fade_in2);
motto.startAnimation(fade2);
fade2.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
startActivity(new Intent(SplashActivity.this,
MenuActivity.class));
SplashActivity.this.finish();
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
});
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en