I'm developping a small aplication with MvvmCross and Xamarin.Forms. I built the project following the tutorial from the MvvmCross website; the thing is that when I try to add a splash screen (on the android project) to appear while the main viewmodel is loading it gets stuck on it... I attach you my Start.cs (which will be equal to a MainActivity file) the setup and the SplashScreen config:
[Activity(
Label = "@string/app_name",
Theme = "@style/AppTheme",
MainLauncher = false,
LaunchMode = LaunchMode.SingleTask,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class Start : MvxFormsAppCompatActivity<Setup, App, FormsApp>
{
//LaunchMode = LaunchMode.SingleTask
//MvxFormsAppCompatActivity<MvxFormsAndroidSetup<App, FormsApp>, App, FormsApp>
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
}
}
Setup:
public class Setup : MvxFormsAndroidSetup<App, FormsApp>
{
}
SplashScreen:
[Activity(
Label = "Template",
MainLauncher = true,
NoHistory = true,
Theme = "@style/AppTheme",
Icon = "@drawable/icon")]
public class SplashScreen : MvxSplashScreenActivity
{
public SplashScreen()
:base(Resource.Layout.SplashScreen)
{
}
protected override void RunAppStart(Bundle bundle)
{
StartActivity(typeof(Start));
base.RunAppStart(bundle);
}
}
Does anybody knows what I'm doing wrong?
What version of MvvmCross you're using?
Generally speaking, try to follow what's in the the Playground samples. For the Xamarin.Forms Droid you should have a look at Playground.Forms.Droid - I would suggest downloading MvvmCross sources (use develop branch) on your machine and trying to run this sample.
I suspect that the problem lies in the part where you're inheriting from MvxSplashScreenActivity
. Try to inherit from the generic version of that class e.g. MvxFormsSplashScreenActivity<Setup, Core.App, FormsApp>
. Have a look at how the splash screen class looks like in the Playground sample
If that doesn't help, then literally check how your app is different from the Playground sample app and fill the missing parts