Xamarin Android shortcuts navigation with MVVMCross

JohnMizJohnMiz Member ✭✭
edited December 6 in Xamarin.Android

Hey,

So I'm trying to add shortcuts to an android app, the project is using MVVMCross for all the navigation.
I got the information from the intent.

This is my code(MainActivity):

      private void NavigateToShortcuts()
      {
           switch (Intent.Action)
           {
                case ACTION_ADD_EXPENSE_VIEW:
                     {
                          System.Diagnostics.Debug.WriteLine("AddExpense");
                          Mvx.IoCProvider.Resolve<AccountListViewActionViewModel>().GoToAddExpenseCommand.Execute(null);
                     }
                     break;
                case ACTION_ADD_INCOME_VIEW:
                     {
                          System.Diagnostics.Debug.WriteLine("AddIncome");
                          Mvx.IoCProvider.Resolve<AccountListViewActionViewModel>().GoToAddIncomeCommand.Execute(null);

                     }
                     break;
                case ACTION_ADD_TRANSFER_VIEW:
                     {
                          System.Diagnostics.Debug.WriteLine("AddTransfer");
                          Mvx.IoCProvider.Resolve<AccountListViewActionViewModel>().GoToAddTransferCommand.Execute(null);
                     }
                     break;
           }
      }

The navigation works fine, but there is something wrong with the state of the activity or something.

In the activity after navigating via the shortcut, I'm trying to navigate back and it doesn't respond, also when I try to do some action like save an expense or select category, I get this exception:

"Android.Views.WindowManagerBadTokenException: Unable to add window -- token [email protected] is not valid; is your activity running?"

(https://us.v-cdn.net/5019960/uploads/editor/jr/sj3vninmmqrd.gif "")

I tried to debug this with no luck.

Is there another way to navigate from an activity using MVVMCross?

Thanks!! :)

Answers

Sign In or Register to comment.