Ran into an issue where my android app is inconsitantly crashing when trying to start an activity. I have been unable to recreate the issue, this has just been taken from the logs of multiple devices where this has occured.
Stacktrace:
2020-03-08 14:58:28.717 5449 5449 I MonoDroid: --- End of managed Java.Lang.NullPointerException stack trace ---
2020-03-08 14:58:28.717 5449 5449 I MonoDroid: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.dispatchCancelPendingInputEvents()' on a null object reference
2020-03-08 14:58:28.717 5449 5449 I MonoDroid: at android.view.ViewGroup.dispatchCancelPendingInputEvents(ViewGroup.java:3893)
2020-03-08 14:58:28.717 5449 5449 I MonoDroid: at android.view.ViewGroup.dispatchCancelPendingInputEvents(ViewGroup.java:3893)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.view.ViewGroup.dispatchCancelPendingInputEvents(ViewGroup.java:3893)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.view.ViewGroup.dispatchCancelPendingInputEvents(ViewGroup.java:3893)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.view.ViewGroup.dispatchCancelPendingInputEvents(ViewGroup.java:3893)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.view.ViewGroup.dispatchCancelPendingInputEvents(ViewGroup.java:3893)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.view.ViewGroup.dispatchCancelPendingInputEvents(ViewGroup.java:3893)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.view.ViewGroup.dispatchCancelPendingInputEvents(ViewGroup.java:3893)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.view.View.cancelPendingInputEvents(View.java:15630)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.app.Activity.cancelInputsAndStartExitTransition(Activity.java:4316)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.app.Activity.startActivityForResult(Activity.java:4295)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.support.v4.app.ActivityCompatJB.startActivityForResult(ActivityCompatJB.java:30)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.support.v4.app.ActivityCompat.startActivityForResult(ActivityCompat.java:162)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:914)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:1009)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.support.v4.app.Fragment.startActivity(Fragment.java:921)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid: at android.support.v4.app.Fragment.startActivity(Fragment.java:910)
2020-03-08 14:58:28.718 5449 5449 I MonoDroid:
Code:
Intent nextActivity = new Intent(Activity, typeof(DrawerActivity));
// If there is no QI configured, return to the Sell Tickets tab, otherwise return to the QI tab
GoToTab tabtogoto;
if (StateHelper.GetBoolean((int)Utilities.Constants.DeviceStorageId.DeviceStorage_IsServiceSelected) || isTablet)
{
tabtogoto = GoToTab.QuickIssue;
}
else
{
tabtogoto = GoToTab.SellTickets;
}
Bundle b = new Bundle();
b.PutInt("TabToGoTo", (int)tabtogoto);
b.PutBoolean(Utilities.Constants.INTENT_EXTRA_RESET_SELL_TIMETABLE_SEARCH_PARAMS, isTablet);
nextActivity.PutExtras(b);
nextActivity.AddFlags(ActivityFlags.SingleTop);
nextActivity.AddFlags(ActivityFlags.ClearTop);
StartActivity(nextActivity);
Need to understand why this is occuring to diagnose further.
Source: View source