Forum Xamarin.Android

Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference


I am currently getting the above error when I am changing the App.Current.MainPage in a Forms application. The scenario this is occurring is as follows:

  1. The first page is a standard content page (login)
  2. After login, the second page is a Master Detail, with the detail as a Navigation Page
  3. If the user is inactive for a period of time, then they are redirected back to the login page when they try to refresh the listview on the detail page.

The following section is the code that is run before it crashes (this is in the ViewModel for the current page):
else //Timeout { //Set the loading/refreshing flags back IsLoading = false; IsRefreshing = false; App.Current.MainPage.IsBusy = false; Cleanup(); // MessagingCenter.Unsubscribe (((MasterDetailPage)App.Current.MainPage).Detail).BindingContext = null; // App.Current.MainPage = _viewFactory.Resolve<LoginViewModel>(); //Returns the LoginView page }// Crashes after this, but I can't see the code

This appears to be a recent occurrence, but I can't see what has changed that could be causing this.

Can anyone provide any clue as to what might be the issue?





  • EricSchmitzEricSchmitz USUniversity ✭✭

    I am having the same issue now in a pretty identical situation.
    Did you ever find a solution to the problem?

  • TonyDTonyD USMember ✭✭✭

    @SamColeman @EricSink did you solve this? Stackoverflow seems to indicate it's related to a mismatch between various versions of Android but I'm not sure how to make a fix for this in Xamarin.

Sign In or Register to comment.