According to the code that I see in GrepCode , we have the following:
public void dismiss() { mPopup.dismiss(); mPopup = null; }
Thus, your NPE is called by mPopup , which is a closed AlertDialog from DialogPopup (a private Spinner class), possibly a dialog box showing the counter settings when you click on it. mPopup installs only on something other than zero in DialogPopup.show() . This method is called when Spinner.performClick() , that is, when clicked with a counter.
But then this is the weird part. The stack trace appears to be when the mPopup element is mPopup because DialogPopup set as OnClickListener . Therefore, at that moment mPopup should not be zero. But when DialogPopup.dismiss() it is zero.
What can this explain? Here is my hypothesis. Well, a monkey is usually pretty fast. Faster than actual users. He may be able to click two elements before mPopup was really fired first by DialogPopup.onClick() . So, we have two calls to DialogPopup.dismiss() , and the second to NPE.
So here are my findings:
- Since we are dealing only with inner classes, and your code is not responsible for running the code that crashed, this is most likely an Android platform error.
- To fix this, you must be able to reproduce and debug the eclipse in order to fully understand what is happening. You will need to download the platform code of the Android platform in order to be able to enter the spinner code. Alternatively, you can put the magazine into Spinner code and create Jelly Beans and burn your phone (or replace framework.jar).
- If my hypothesis is correct, then debugging with ecplise will not help. You need logs to debug the problem. But if my hypothesis is correct, then we think that we should not worry. The average user is unlikely to be able to click so quickly.
- You could advise the Android guys to do an if-null check. But only after you have found the real root cause. Otherwise, you will mask the problem.
source share