0

你能告诉我这个对上层构造函数的调用是否有问题吗?每次我尝试使用此构造函数创建一个新对象时,应用程序都会崩溃,我已经检查过并且我发送的参数是正确的,但仍然崩溃......

package com.example.bulbcontrol2;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;

public class ConnectionTool extends Socket
{   
    private PrintWriter outputData;
    private BufferedReader inputBuffer;
    private String message = null;

    public ConnectionTool(InetAddress host, int port) throws IOException 
    {   
        super(host,port);
        outputData = new PrintWriter(this.getOutputStream(), true);
        inputBuffer = new BufferedReader(new InputStreamReader(this.getInputStream()));
    }
}

例外:

10-31 12:35:56.407: W/dalvikvm(9971): threadid=1: thread exiting with uncaught exception (group=0x41577700) 
10-31 12:35:56.407: E/AndroidRuntime(9971): FATAL EXCEPTION: main 
10-31 12:35:56.407: E/AndroidRuntime(9971): java.lang.RuntimeException: Error receiving broadcast Intent { act=open_connection flg=0x10 } in com.example.bulbcontrol2.AsyncConnection$1@41e3ee90 
10-31 12:35:56.407: E/AndroidRuntime(9971): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:773)
4

0 回答 0