Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can't see anything obviously wrong with your setup.</p> <p>The default Droid framework setup looks for classes which implement IMvxAndroidView in the ExecutingAssembly using the logic in: <a href="https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross/Platform/MvxBaseSetup.cs#L200" rel="nofollow">https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross/Platform/MvxBaseSetup.cs#L200</a></p> <p>So I can't see any obvious reason why your LoginActivity View isn't being picked up.</p> <p>One quick thing you could do is to add some debug code to your Setup.cs to see what views are being detected:</p> <pre><code> protected override IDictionary&lt;Type, Type&gt; GetViewModelViewLookup() { var toReturn = base.GetViewModelViewLookup(); MvxTrace.Trace("Tracing viewModels and views"); foreach (var kvp in toReturn) { MvxTrace.Trace("Seen pair {0} : {1}", kvp.Key.Name, kvp.Value.Name); } return toReturn; } </code></pre> <p>If that shows the list is empty or missing your activity, then I'm afraid we'd need to step through the reflection logic to find out why it's not picking up your Activity.</p> <hr> <p>In real desperation, you could also fake the results:</p> <pre><code> protected override IDictionary&lt;Type, Type&gt; GetViewModelViewLookup() { return new Dictionary&lt;Type,Type&gt;() { { typeof(LoginViewModel), typeof(LoginActivity) } }; } </code></pre> <p>But this probably isn't the right long-term solution for you</p> <hr> <p>If this is caused by some kind of 'solution setup' difference - e.g. if you have somehow put your Setup.cs in a different project to your views - then it may be that somehow overriding the default convention will help you.</p> <p>To achieve this, in you Setup.cs, override the code:</p> <pre><code> public virtual Assembly ExecutableAssembly { get { return GetType().Assembly; } } protected override IDictionary&lt;System.Type, System.Type&gt; GetViewModelViewLookup() { return GetViewModelViewLookup(ExecutableAssembly, typeof (IMvxAndroidView)); } </code></pre> <p>in the base setup class - <a href="https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Droid/Platform/MvxBaseAndroidSetup.cs" rel="nofollow">https://github.com/slodge/MvvmCross/blob/vnext/Cirrious/Cirrious.MvvmCross.Droid/Platform/MvxBaseAndroidSetup.cs</a></p> <p>This can be done either by overriding the ExecutingAssembly property (although this seems a bit wrong given it's name) or by overriding the GetViewModelViewLookup method. For example, if you wanted to look in several separate assemblies you could use:</p> <pre><code> public List&lt;Assembly&gt; MyViewAssemblies { get; set; } protected override IDictionary&lt;System.Type, System.Type&gt; GetViewModelViewLookup() { var toReturn = new Dictionary&lt;Type, Type&gt;(); foreach (var assembly in MyViewAssemblies) { var contributions = base.GetViewModelViewLookup(assembly, typeof (IMvxAndroidView)); foreach (var kvp in contributions) { toReturn[kvp.Key] = kvp.Value; } } return toReturn; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload