passing reference of class to another class android error
- by prolink007
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;
}
}