[mono-android] Corrected post - Cannot use StartActivity() from IAnimationListener
Michael Reynolds
basheps at gmail.com
Tue Mar 15 14:44:31 EDT 2011
I am trying to convert the java code below to use it in my MonoDroid
project.
fade2.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
// The animation has ended, transition to the Main Menu screen
startActivity(new Intent(MySplashActivity.this,
MyMenuActivity.class));
MySplashActivity.this.finish()
;
}
I converted the Java code above to the C# code below:
fade2.SetAnimationListener(new AnimationListener(this));
And the C# AnimationListener:
private class AnimationListener : Activity, Animation.IAnimationListener
{
private readonly Context _context;
public AnimationListener(Context context)
{
_context = context;
}
public void OnAnimationEnd(Animation animation)
{
//The animation has ended, transition to the Main Menu screen
StartActivity(new Intent(_context, typeof (QuizMenuActivity)));
((Activity)_context).Finish();
}
public void OnAnimationRepeat(Animation animation)
{
}
public void OnAnimationStart(Animation animation)
{
}
}
The Java StartActivity works but the C# version doesn't in the sample -
It shuts down and I don't get any error details.
Can you tell me why and how to fix it?
Or if there is a better way the convert this sample?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110315/5355bb68/attachment.html
More information about the Monodroid
mailing list