NullPointerException in handleStopActivity — No reference to my code in stack trace

前端 未结 5 779
别跟我提以往
别跟我提以往 2020-12-28 17:31

I\'m a bit at a loss, here. I\'ve been seeing a steadily increasing number of these NullPointerExceptions in handleStopActivity. I suspect that the

5条回答
  •  灰色年华
    2020-12-28 18:05

    I don't know, if you're still looking for a solution, but here's what I found out. If you have found a real solution, please let me know.

    I just had the same issue.. I never had that problem and without changing code, it appeared for some reason. By using google, I found the question that Joseph posted, but that doesn't seem to be exactly the same. I also found this and this. These two seem to have the same issue, but no solution.. Then I found this blog.

    The author tells something about what it's from - a bug in Android. Further, it has to do with a Cursor. That didn't fix my issue, but I noticed, that I used a Cursor, a few lines before calling startActivity(someIntent); (I also called finish(), but removing that line didn't make a difference).
    I tried to remove the lines that include the Cursor and suddenly it works again..
    I have no idea, why it works, but it does. I just moved the code with the Cursor to my other Activity.

    It's definitly not a good solution, but it works for me.

    There's just one more question: Do you even use a Cursor and call startActivity(..) or something similar?

    Edit:
    I just found out, that I didn't fix the problem, I just didn't test enough. The Activity I started was running fine until I wanted to create the next Activity out of that Activity I started before. On starting the next Activity, my App crashes again.

提交回复
热议问题