new Thread(new Runnable(){
@Override
public void run() {
try {
// Your implementation
clientSocket = new Socket("192.168.0.112", 9874);
outToServer = new DataOutputStream(clientSocket.getOutputStream());
inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
//ClientReceiveThread clientReceiveThread = new ClientReceiveThread(clientSocket,textview);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}).start();
即使我试图在一个单独的线程上执行网络任务,为什么它仍然给我网络主线程异常