I tried the following in my activity:

        mServiceConnection =  new
DbServiceConnection(mDatabaseBinder);
        final Intent databaseServiceIntent = new Intent(this,
DatabaseService.class);
        this.bindService(databaseServiceIntent, mServiceConnection,
Context.BIND_AUTO_CREATE);

        while(mDatabaseBinder == null) {
                try {
                                Thread.sleep(100);
                        } catch (InterruptedException e) {
                                // catch...
                        }
        }

Did you mean that? Now it should wait until the mDatabaseBinder is set
which should be in the onServiceConnected() method but that code
results in an endless loop, mDatabaseBinder stays null. Maybe I got it
wrong how the components work together. As far as I understood it, you
have a service running in the background, which returns a binder in
onBind(). The service connection "fills" the binder
onServiceConnected() so it can be used in the activity to access the
services variables. Is that wrong?

On 6 Aug., 10:26, Kostya Vasilyev <kmans...@gmail.com> wrote:
> Sure. The service connection callback you seem to already have in your code.
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For 
more information about this change, please read [http://goo.gl/xkfl] or visit 
the Group home page.

Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to