Skip to content

Instantly share code, notes, and snippets.

@mdcarmo mdcarmo/SplashActivity.cs
Last active Apr 23, 2018

Embed
What would you like to do?
SplashActivity
[Activity(Theme = "@style/Theme.Splash",
MainLauncher = true, NoHistory = true)]
public class SplashActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
}
protected override void OnResume()
{
base.OnResume();
Task startupWork = new Task(() => { SimulateStartup(); });
startupWork.Start();
}
// Simulates background work that happens behind the splash screen
async void SimulateStartup()
{
await Task.Delay(2000);
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.