Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Android.App;
- using Android.Content;
- using Android.OS;
- using Android.Runtime;
- using Android.Support.V7.App;
- using Android.Util;
- using Android.Views;
- using Android.Widget;
- namespace PariwisataApp
- {
- [Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true)]
- public class SplashActivity : Activity
- {
- static readonly string TAG = "X:" + typeof(SplashActivity).Name;
- public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
- {
- base.OnCreate(savedInstanceState, persistentState);
- Log.Debug(TAG, "SplashActivity.OnCreate");
- }
- // Launches the startup task
- 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()
- {
- Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
- await Task.Delay(8000); // Delay waktu menuju MainActivity
- Log.Debug(TAG, "Startup work is finished - starting MainActivity.");
- StartActivity(new Intent(Application.Context, typeof(LoginActivity)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement