Skip to content

Instantly share code, notes, and snippets.

@Delaire
Created January 14, 2020 16:41
Show Gist options
  • Save Delaire/40c1c563d87d3a68645fc21b5c0a34ba to your computer and use it in GitHub Desktop.
Save Delaire/40c1c563d87d3a68645fc21b5c0a34ba to your computer and use it in GitHub Desktop.
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : AppCompatActivity
{
static readonly string TAG = "X:" + typeof(SplashActivity).Name;
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
{
base.OnCreate(savedInstanceState, persistentState);
// Create your application here
// app Init
new App(this);
}
// Launches the startup task
protected override void OnResume()
{
base.OnResume();
Task startupWork = new Task(() => { StartupApp(); });
startupWork.Start();
}
async void StartupApp()
{
Log.Debug(TAG, "Startup work is finished - starting MainActivity.");
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