Reputation: 4302
I am new to MvvmCross 6.0 and Xamarin.
I am trying to follow the tutorial here that for MvvmCrosss 5.5
I followed the explanation,
<?xml version="1.0" encoding="utf-8" ?> <core:MvxFormsApplication xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:core="clr-namespace:MvvmCross.Forms.Core;assembly=MvvmCross.Forms" x:Class="App3.App"> </core:MvxFormsApplication>
public class CoreApp : MvxApplication { public override void Initialize() { CreatableTypes() .EndingWith("Service") .AsInterfaces() .RegisterAsLazySingleton(); CreatableTypes() .EndingWith("Client") .AsInterfaces() .RegisterAsLazySingleton(); // register the appstart object RegisterAppStart<MainPageViewModel>(); } }
public class MainPageViewModel : MvxViewModel { }
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="Center"
HorizontalOptions="Center" />
[Activity(Label = "MvvmcrossGettingStarted", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : MvxFormsAppCompatActivity { protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle); var startup = Mvx.Resolve<IMvxAppStart>(); startup.Start(); InitializeForms(bundle); } } public class Setup : MvxFormsAndroidSetup { public Setup():base() { } protected override IEnumerable<Assembly> AndroidViewAssemblies => new List<Assembly>(base.AndroidViewAssemblies .Union(new[] { typeof(App).GetTypeInfo().Assembly }) .Except(new[] { this.GetType().Assembly }) ); protected override Application CreateFormsApplication() { return new App(); } protected override IMvxApplication CreateApp() => new CoreApp(); }
However what I started the app, its gives me null exception saying "bundle" parameter is null in OnCreated method.
P.S. The tutorial mention to create the Setup.cs, but I have no idea how does that Setup.cs being run by the code.... I see no where that is referencing it.
Upvotes: 1
Views: 871
Reputation: 4405
I'm not sure why you're looking at the version 5.5 tutorial while working with v 6.0. Try following step by step guide, from same author, but for version 6.0
You might also want to download Nick's sample, from his GitHub repo, to check how things work.
Upvotes: 3