24.03.2011 15:25, Sambhav ?????:
After successful connection to the serivce the *onServiceConnected *callback is called. So unitl this callback is called the activity should be blocked from making any calls to the Service.

Correct.

Except not "blocked", just "unable to call a bound service until it's actually bound".

Now if I do a sleep in the Activity in order to wait till *onServiceConnected *is called , *onServiceConnected *gets called after the sleep is over.

Don't ever call sleep() or wait() in the UI thread.

From my observation it looks like *onServiceConnected* is getting called in the same thread as the Activity.

Yes.

Review the fundamentals here:

http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html#Threads

So I am not able to block the Acitivity to make call to the Serive until the it is successfully connected.

Don't block the activity. Return back to Android from whatever callback you were in when you called bindService.

The framework will call your service connection's onServiceConnected when it happens.

http://developer.android.com/guide/topics/fundamentals/bound-services.html

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
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

Reply via email to