Xamarin在Acer Liquid Z530上的闪屏后形成黑屏

时间:2016-05-23 07:23:08

标签: xamarin xamarin.forms splash-screen

我的闪屏之后有时会出现黑屏。当我在三星Galaxy S4上运行我的应用程序时,我有时会看到黑屏,但是当我使用Acer Liquid Z530运行我的应用程序时,我总是会出现黑屏

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Support.V7.App;
using Android.Util;
using System.Threading.Tasks;

namespace Dharma.Droid
{
[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);
        Log.Debug(TAG, "SplashActivity.OnCreate");
    }

    protected override void OnResume()
    {
        base.OnResume();

        Task startupWork = new Task(() =>
            {
                Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
                Task.Delay(5000); // Simulate a bit of startup work.
                Log.Debug(TAG, "Working in the background - important stuff.");
            });

        startupWork.ContinueWith(t =>
            {
                Log.Debug(TAG, "Work is finished - start Activity1.");

                StartActivity(new Intent(Application.Context, typeof (MainActivity)));  


            }, TaskScheduler.FromCurrentSynchronizationContext());

        startupWork.Start();
    }
}
}

0 个答案:

没有答案