passing reference of class to another class android error

Posted by prolink007 on Stack Overflow See other posts from Stack Overflow or by prolink007
Published on 2011-01-18T02:45:15Z Indexed on 2011/01/18 2:53 UTC
Read the original article Hit count: 165

Filed under:
|
|
|

I recently asked the precursor to this question and had a great reply. However, when i was working this into my android application i am getting an unexpected error and was wondering if everyone could take a look at my code and help me see what i am doing wrong.

Link to the initial question: passing reference of class to another class

My ERROR: "The constructor ConnectDevice(new View.OnClickListener(){}) is undefined"

The above is an error detected by eclipse.

Thanks in advance!

Below are My code snippets:

public class SmartApp extends Activity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.intro);

        final Button connectDeviceButton = (Button) findViewById(R.id.connectDeviceButton);
        connectDeviceButton.setOnClickListener(
        new View.OnClickListener()
        { 
   @Override
   public void onClick(View v) {
    Thread cThread = new Thread(new ConnectDevice(this));
    cThread.start();
   }
  });
    }
}

public class ConnectDevice implements Runnable {

 private boolean connected;
 private SmartApp smartAppRef;
 private ObjectInputStream ois;

 public ConnectDevice(SmartApp smartAppRef) {
  this.smartAppRef = smartAppRef;
 }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about android