Launching error on Android Mdpi Tablet: black screen shows

时间:2016-03-02 10:55:49

标签: android xamarin xamarin.android mvvmcross

Hey I am working on Xamarin and Mvvmcross, my issue is, when I start the app on (Samsung Galaxy Tab 3) Mdpi device then it show black screen and nothing happens, here is my code,

Splash.cs

namespace Mobile.UI.Droid
{
    [Activity(
        Label = "Mobile Tasks"
        , MainLauncher = true
        , Icon = "@drawable/icon"
        ,Theme = "@style/MyActionBarSplash"
        , NoHistory = true)]

    public class SplashScreen : MvxSplashScreenActivity
    {
        public SplashScreen()
            : base(Resource.Layout.SplashScreen)
        {
        }
    }
}

setup.cs

public class Setup : MvxAndroidSetup
{
    Context _context;
    public Setup(Context applicationContext) : base(applicationContext)
    {
        _context = applicationContext;
        CurrentPlatform.Init();

        Insights.Initialize(XamarinInsightsConstants.APIKey, applicationContext);
    }
    protected override IMvxAndroidViewPresenter CreateViewPresenter()
    {
        var presenter = new CustomDroidViewPresenter();
        Mvx.RegisterSingleton(presenter);
        return presenter;
    }
    protected override IMvxApplication CreateApp()
    {
        return new Core.App();
    }

    protected override System.Collections.Generic.IList<string> ViewNamespaces
    {
        get
        {
            var toReturn = base.ViewNamespaces;
            toReturn.Add("MOBILE.Mobile.UI.Droid.Controls");
            toReturn.Add("MOBILE.Mobile.UI.Droid.Utilities");
            return toReturn;
        }
    }
    protected override IMvxTrace CreateDebugTrace()
    {
        return new DebugTrace();
    }

    protected override void InitializeLastChance()
    {            
        var errorHandler = new ErrorDisplayer(ApplicationContext);
        //Cirrious.MvvmCross.Plugins.Color.PluginLoader.Instance.EnsureLoaded();
        base.InitializeLastChance();
        Mvx.RegisterSingleton<IDeviceDetails>(new CustomDroidDetails());
        //Mvx.RegisterSingleton<ILogger>(new DroidLogger());
        Mvx.RegisterSingleton<IVersionDetail>(new VersionDetail());
    }

    protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
    {
        base.FillTargetFactories(registry);
        registry.RegisterFactory(new MvxCustomBindingFactory<LinearLayout>("ShapeBackground", (view) => new ShapeBackgroundBinding(view)));
        registry.RegisterFactory(new MvxCustomBindingFactory<TextView>("CustomText", (view) => new CustomTextBinding(view)));
    }
}

VersionDetail.cs

public class VersionDetail : IVersionDetail
{
    public string GetAppVersion()
    {
        var version = Application.Context.PackageManager.GetPackageInfo(Application.Context.PackageName, 0).VersionName;
        return version;
    }
}

CustomDroidDetails

 public class CustomDroidDetails : IDeviceDetails
{
    public Platform Platform
    {
        get { return Platform.Droid; }
    }
    public DeviceType DeviceType
    {
        get { return DeviceType.Phone; }
    }

}

logcat Error

0 个答案:

没有答案