While trying to safe my threads I recognized something pretty wired
which I don't really understand.

1) I'm binding to my service with bindService(..) in onCreate()
2) onServiceConnected() gets called
3) Inside the method onServiceConnected I'm calling unbindService()
(just for testing)
4) Directly after unbindService() I'm starting a new background thread
5) Inside the thread I'm calling methods with my service object inside
the service

And this is working. But why is this working? After unbindService(...)
onServiceDisconnected gets called and the IMyService object is set to
null. So why can I use the object in my background thread?

In addition I recognized some different behaviour and that's what I
was doing:

1) I'm binding to my service with bindService(..) in onCreate()
2) onServiceConnected() gets called, inside the method I'm starting a
background thread
3) I'm communicating with my service through the object obtained in
onServiceConnected
4) I'm trying to call unbindService() from inside my backrgound thread
but also from outside

Result:

When unbindService(..) gets called I'm getting a "service not
registered" exception. But why?

I thought that I'm understanding the picture but that left me with a
wired felling. I don't really know whats happening.

I'm looking forward reading your thoughts.

Regards!
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to