I have class that is declared in MainActivity:
public class MainActivity extends ListActivity {
public class CommunicatorServiceImpl implements CommunicatorService{
@Override
public Communicator createCommunicatorThread(BluetoothSocket socket) {
return new CommunicatorImpl(socket, new CommunicatorImpl.CommunicationListener() {
@Override
public void onMessage(final String message) {
runOnUiThread(new Runnable() {
@Override
public void run() {
textData.setText(textData.getText().toString() + "\n" + message);
}
});
}
});
}
}
private final CommunicatorService communicatorService = new CommunicatorServiceImpl();
}
I need to transfer communicatorService to the service. This object, along with the service, will use the thread. As I know, I can't transfer an object as an argument of the service constructor. How can I do this?
Thanks in advance.