tags:

views:

54

answers:

0

I am trying to start a service in android after it is constructed:

String ip = ((EditText)findViewById(R.id.ip)).getText().toString();
int port = Integer.valueOf( ((EditText)findViewById(R.id.port)).
                                          getText().toString() );

        try {
            IConnectionManager connectionManager = 
                new SocketConnectionManager(ip, port);
            Alerter alerter = new Alerter(connectionManager);
                            **//tell android to start alerter**
        } catch (IOException e) {
            // show a dialog 
            e.printStackTrace();
        }

It seems that android insists on instantiating the class it self. Does anyone know a way of injecting the dependencie without resorting to global state?