Android:Executor.execute由于某种原因失败

Android:Executor.execute由于某种原因失败,android,threadpool,executor,Android,Threadpool,Executor,在线程的run()方法中,前面我有以下代码片段: updateConversationHandler.post(new updateUIThread(read,write,this.clientSocket,input,out)); 它过去是有用的。但当我用遗嘱执行人来称呼它时,它失败了: executor = Executors.newFixedThreadPool(5); executor.execute(ne

在线程的run()方法中,前面我有以下代码片段:

updateConversationHandler.post(new updateUIThread(read,write,this.clientSocket,input,out));
它过去是有用的。但当我用遗嘱执行人来称呼它时,它失败了:

                    executor = Executors.newFixedThreadPool(5);
                    executor.execute(new updateUIThread(read,write,this.clientSocket,input,out));
上面的代码没有响应


任何建议???

因为您的执行者对更新会话处理程序一无所知 根据您的参数创建构造函数:

类updateUIThread实现可运行{ 私有字符串msg

        public updateUIThread(String str) {
            this.msg = str;
        }

        @Override
        public void run() {
            text.setText(text.getText().toString()+"Client Says: "+ msg + "\n");
        }
    }

确定问题已解决。已删除“Toasts”和“text.setText()”的所有实例。现在可以正常工作


Android团队必须列出这些错误,并在他们的网站上列出。类似于“错误消息——可能的原因——解决方案”。这样。

Alex,我不明白。Updateconversationhandler属于Handler类型。它如何影响执行者?它说,“只有创建视图层次结构的原始线程才能接触其视图。”