我需要先睡5秒钟,然后从第一活动转到第二活动,然后再转到第二活动。我的第一个活动包含使用以下代码旋转的图像-ImageForRotation.StartAnimation(loadedImage)
第二个活动是登录页面。这是我的代码-
base.OnCreate(bundle);
SetContentView(Resource.Layout.SplashScreen);
ImageView ImageForRotation = FindViewById < ImageView > (Resource.Id.imageForRotation);
var loadedImage = AnimationUtils.LoadAnimation(this, Resource.Animation.SplashScreenImageRotation);
ImageForRotation.StartAnimation(loadedImage);
//here the code for 5 second wait time which i don't know
StartActivity(typeof(LoginScreen)); //second activity
最佳答案
这样,这是您的第一个活动
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
NextActivity();
}
public void NextActivity()
{
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
Intent mainIntent = new Intent(MainActivity.this,Main2Activity.class);
MainActivity.this.startActivity(mainIntent);
MainActivity.this.finish();
}
}, 5000);
}