Closed muhammadarif1 closed 6 years ago
Oh my god what on earth is happening here.
I originally couldn't reproduce the issue on my device, then after watching the recording (which was quite useful, thank you for including this much information with the report), I realized that for some reason your phone is completely ignoring the activity/fragment lifecycle. In other words, when you rotate your phone, the activity state is preserved (it shouldn't be, but that isn't really the issue here), and the fragment is recreated without calling onCreate, which initializes the list. The MainActivity then detects the swipe event and asks the fragment for information to update its overflow menu, causing it to iterate through a list that hasn't been initialized yet, and causing the crash. What the heck.
It's easy enough to add a null check for this, but this should never occur in the first place. Of course it would never happen if I hadn't implemented such a hacky method of adding stuff to an overflow menu in the first place (the fragment should get its info from the activity, not the other way around), but agh [insert rant about Android fragmentation here] [insert rant about crappy OEM skins here] I hate Android sometimes.
EXPECTED BEHAVIOR
when users change the position of their phone screen users should still be able to use this app well
ACTUAL BEHAVIOR
when the user changes the position of their phone screen then the user refresh the list of applications that will make the status, this application will crash.
HOW TO REPRODUCE
BUG RECORDING
https://youtu.be/Qq0BlYYk4sE
logcat file