2012/6/4 Greenhand <cooperateonl...@gmail.com> > if(serviceBound == false){ > bindService(new > Intent(getApplicationContext(),MessengerService.class), > serviceConnection, BIND_AUTO_CREATE); //!!! > Log.d("MyMediaPlayerActivity","Activity: bindService()"); > }else{ > Log.d("MyMediaPlayerActivity","Activity: serviceBound == true"); > } >
> Nevertheless, after my log "Activity: serviceBound == true" is > printed, Android complains "Activity has leaked ServiceConnection that > was originally bound here" at the line with !!! mark. > Right, that's because you're calling bindService on the {old} activity object. What you want is this: getApplicationContext().bindService(new Intent(this, MessengerService.class), serviceConnection, BIND_AUTO_CREATE); -- K -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en