Saturday, December 8, 2018

onCreateOptionsMenu can be called before onCreate

Today I investigated a NullPointerException crash inside an activity's onCreateOptionsMenu. It was strange because the reference that was null is always initialized by onCreate. Apparently, onCreateOptionsMenu can be called first, though apparently that's not usually the case. I was able to trigger it by opening the activity in question, switching to the Settings app, revoking a permission from my app, and switching back to my app.

No comments:

Post a Comment