runtime exception can't create handler inside thread that has not called looper.prepare error

陌路散爱 提交于 2019-12-02 13:15:24

Probably the error arise because of this line

 Toast.makeText(getApplicationContext(),
                    e.getMessage(),
                    Toast.LENGTH_LONG).show();

inside doInBackground.Toast has to been shown on the UIThread. Instead you are using the doInBackground thread to show it. In general, all the operations regarding the UI have to be executed on the UI Thread. If you want to fix, you could use an handler to post a runnable on the UI Thread queue that shows a Toast

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!