Skip to content

Instantly share code, notes, and snippets.

@mdcarmo
Last active April 23, 2018 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdcarmo/80b124a0948d51b2014315271c12afef to your computer and use it in GitHub Desktop.
Save mdcarmo/80b124a0948d51b2014315271c12afef to your computer and use it in GitHub Desktop.
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