Last active
April 23, 2018 01:08
-
-
Save mdcarmo/80b124a0948d51b2014315271c12afef to your computer and use it in GitHub Desktop.
SplashActivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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