【问题标题】:not able to make a call to POST from async task [duplicate]无法从异步任务调用 POST [重复]
【发布时间】:2011-08-26 22:36:26
【问题描述】:

可能重复:
Can't create handler inside thread that has not called Looper.prepare() inside AsyncTask for ProgressDialog

我在调用方法时遇到以下异常,该方法最终从我的异步任务中调用 POST 方法:

“无法在 Android 中未调用 Looper Prepare 的线程内创建处理程序”。

我正在使用异步任务来显示进度对话框。

你能帮帮我吗?

谢谢

【问题讨论】:

  • 你也应该发布你的代码,否则我们怎么知道你在哪里做错了?

标签: android android-asynctask


【解决方案1】:

Can't create handler inside thread that has not called Looper.prepare() inside AsyncTask for ProgressDialog 的副本

简而言之:进度对话框的show() 方法必须从UI 线程调用,而不是从后台线程调用。为此,请使用 onProgressUpdateonPreExecute

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多