Closed danieleardissone closed 8 years ago
Do you have a reproduction repo so i could test this?
Yes, I just created MvxAndroidFragmentsTest. It's a smaller version of my application that contains just the files to reproduce the problem. I hope it could be enough to understand what's going wrong with it. Thank you.
Are there any updates?
@danieleardissone, you have a SettingsFragment
but SettingsViewModel
. Lookup mechanism uses class naming, so you need to have SettingsView
. Or just add the ViewModel type at the fragment attribute:
[MvxFragment((typeof(FragmentsHostViewModel)), Resource.Id.content_frame), ViewModelType = typeof(SettingsViewModel)]
[Register("mvxandroidfragmentstest.droid.views.fragments.SettingsFragment")]
public class SettingsFragment : BaseNavigationFragment<SettingsViewModel>
{
}
Thank you @Prin53 now it works! I didn't know how to specify the viewmodel type for a fragment with a different class name.
Hi all, I'm trying to convert in MvvmCross 4 an old Xamarin Android project that use MvvmCross 3.5. I followed the sample provided by @martijn00 to manage fragments but I get this exception during the loading process of the app:
Debugging the code I noticed that it happens immediately after the Android Setup. Using the right annotations in the fragment like the sample, I expect that MvvmCross maps every fragment with the corresponding view model but seems that it's not happening. Do I have to explicitely force this mapping in a specific way? Any idea about what am I doing wrong?
I'm using MvvmCross 4.3.0 and the latest stable Xamarin release, of course.
My fragment definition:
Presenter definition in Setup.cs:
Thanks.
Daniele