RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

前端 未结 2 1437
北荒
北荒 2021-01-27 06:14

I\'ve got a code with an ASyncTask and the problem is that when I execute it several times it crashes with this exception: RuntimeException: Only one Looper may be created per t

2条回答
  •  情深已故
    2021-01-27 06:59

    As the stack trace tells you, your problem originates from line 29 of Parser.java, in the Parser initializers. You will note that this is not the source code you included here, which is for LoadNews.

    Based on the preceding line of the stack trace, either:

    • Parser inherits from Activity

    • Parser is trying to instantiate an Activity

    Neither of those is possible.

提交回复
热议问题