Aside from whatever bug you have, for animations across activities you will probably get a much better result by using window/activity animations:
http://developer.android.com/reference/android/app/Activity.html#overridePendingTransition(int, int) API demo: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/Animation.html (whoops just noticed the comment for that class is wrong.) On Wed, Dec 29, 2010 at 11:27 AM, Adonis <[email protected]> wrote: > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

