android - android中asynctask中的警报对话框

标签 android android-layout

我需要在 android 中的 Asynctask 中显示 Alertdialog,但它不会在抛出异常时显示。

05-13 14:59:35.522: WARN/System.err(1179): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

谢谢。

最佳答案

无法从后台线程操作 UI。为此使用处理程序或 AsyncTask 的 onPre/Post 方法。

关于android - android中asynctask中的警报对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5990143/

相关文章:

android - 访问 mObservables 时对 RecyclerView 适配器进行单元测试会引发 NullPointerException

android - android中EditText的默认inputType

android - com.android.layoutlib.bridge.MockView 无法转换为 android.view.ViewGroup

java - Android 应用程序仅安装一次

android - 如果由 android :layout_width ="match_parent" 设置 getWidth() 返回 0

android - 具有起始填充的水平 RecyclerView

android - 如何在具有不同类型消息的聊天应用程序上组织 RecyclerView?

android - 为什么我不能在 Theme.Appcompat 中使用 TextInputLayout(来自支持设计库)

android - 使用此命令在移动设备中运行 ionic 应用程序时出现错误(ionic cordova run android)

android - 使用 GraphView 库 android 从 Json 数据绘制图形