Android:找不到 Looper.quit()

发布于 2024-09-27 06:55:48 字数 246 浏览 0 评论 0原文

标题说明了一切。我有一个扩展 AsyncTask 的类。我使用 new classname.execute() 直接在主线程中调用它。

现在在 doInBackground(params) 中我有 Looper.prepare。 由于我收到错误“每个线程只能创建一个 Looper”,因此我需要在其中使用 Looper.quit() 。但是当我编写 Looper.quit(); 时,我无法在 Looper 类中找到它。

那么如何使用这个退出功能

The title explains it all. I have a class that extends AsyncTask. I call it directly in main thread using new classname.execute().

Now in the doInBackground(params) i have Looper.prepare.
Since i am getting an error "Only one Looper may be created per thread", i need to use Looper.quit() inside it. But i am not able to find it inside Looper class when i write Looper.quit();

So how to use this quit function

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

み青杉依旧 2024-10-04 06:55:48

您必须调用 Looper.myLooper().quit()

You have to invoke Looper.myLooper().quit()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文