MvxActivities
MvxActivities
are an extended object from a regular Android Activity
; the app knows we are using the MVVMCross binding system.
Let's implement MainPageMvxActivity
:
[Activity(Label = "Audio Player")] public class MainPage : MvxActivity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetupIoC(); SetContentView(Resource.Layout.MainPage); } private void SetupIoC() { Mvx.RegisterType<ISoundHandler, SoundHandler>(); PortableMvxIoCRegistrations.InitIoC(); } }
We will need to set up our IoC registrations in the IoC container when this activity is created. Then we simply set the content view to the XML sheet we created previously. Let's test out the Android application and click run; you should now have a MainPage ...
Get Xamarin Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.