Hi I am a little confused about when ServiceConnection.onServiceConnected is actually called. After debugging I realised that it happens after the UI is built. When I call bindService() it returns an immediate "true", but the onServiceConnected() method isn't even called by then. So I cannot call methods from the stub in onResume or onStart()?
So, service is still NULL, for example in an onResume() method: onResume() { sc = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder binder) { service = [whatever].Stub.asInterface(binder); } @Override public void onServiceDisconnected(ComponentName name, IBinder binder) { service = null; } }; boolean bound = bindService(bla,bla,bla); if(bound && service!=null) { //gets never called, service is still null while bound is true } } onPause() { unbindService(sc); } After onResume(), when the Activity is already displayed, onServiceConnection() gets eventually called. But I cannot get any information from the service before then, as described above in onResume(). Furthermore, I observed that an unbindService() does not call onServiceDisconnected. So, if the Activity was stopped and not destroyed, the service variable is not null. If it was destroyed, it is only null because it is newly created. Can someone reproduce this behaviour? By the way, the service was already started in onCreate(). Regards Christoph --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---