方法一: 使用Handler().PostDelayed 延迟启动
new Handler().PostDelayed(
()=>
{
Intent localIntent = new Intent(this, typeof(LoginActivity)); StartActivity(localIntent);
} , 2000); //2000是延迟的时间,2000毫秒,2秒,下面类似
方法二:
1、 继承TimerTask
public class newTimer :TimerTask
{
private Activity oldActivity;
private delegate void startActivity(Intent intent);
public Intent intent;
public newTimer(Activity _oldActivity)
{
oldActivity = _oldActivity;
}
public override void Run()
{
intent = new Intent(oldActivity, typeof(LoginActivity));
oldActivity.StartActivity(intent);
}
}
2、 启动
Timer timer = new Timer();
timer.Schedule(new newTimer(this),3000);