Toine db
Toine db

Reputation: 779

Multiple Activities in Android using MVVMCross?

I'm working on an Xamarin Android app using MVVMCross and have (only for android) multiple screens/activities I want to start from.

I tried to duplicate the SplashScreen, but then none of the Activities boot anymore.

Any suggestions how to get multiple Activities with MainLauncher=true workable?

Upvotes: 0

Views: 538

Answers (1)

Martijn00
Martijn00

Reputation: 3559

You should add a AppStart.cs to your core project and add this function:

public async void Start(object hint = null)
        {
            if (CheckSomething == true)
                ShowViewModel<ViewModels.FirstViewModel>();
            else
                ShowViewModel<ViewModels.SecondViewModel>();
        }

Then in your App.cs do:

public override void Initialize()
        {
            RegisterAppStart(new AppStart());
        }

Upvotes: 2

Related Questions