can't bind to a local service.

by sdphil » Thu, 10 Sep 2009 02:38:17 GMT


Sponsored Links
 I have the following base activity.

public class BaseActivity extends Activity
...
...
... onCreate(...) {
        this.bindService(new Intent(BaseActivity.this,
LocalService.class), serviceConn, Context.BIND_AUTO_CREATE);
    }
...
    private ServiceConnection serviceConn = new ServiceConnection() {
                @Override
                public void onServiceConnected(ComponentName name, IBinder 
service)
{
                        LocalService.LocalBinder binder = 
(LocalService.LocalBinder)
service;
                        service = binder.getService();
                }
...
    };

A derived activity fails on the call to cast a binder --

LocalService.LocalBinder binder = (LocalService.LocalBinder) service;

fails with this on the call stack --

InvocationTargetException.<init>(Throwable) line: 56
ActivityThread.main(String[]) line: 3948

what am I doing wrong?

tia.
--~--~---------~--~----~------------~-------~--~----~



can't bind to a local service.

by Dianne Hackborn » Thu, 10 Sep 2009 03:43:21 GMT


 Did you publish the service in your manifest?






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


can't bind to a local service.

by sdphil » Thu, 10 Sep 2009 03:48:43 GMT


 egads!  that was it (well, kinda)

I had it in there, but I had it as remote --
 android:process=":remote"

thanks!




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Spacing between two LinearLayouts - How to achieve it with XML?

Hello.

At the moment I'm using the following layout.

http://paste.pocoo.org/show/101642/

Module one and two get added in code. Now I'd like to have a 10px
spacing between the two modules. I have tried to set
"layout_topMargin" to the parent LinearLayout but it doesn't work. In
addition I have tried to set this parameter to the LinearLayout
modules. But well it doesn't work. It always looks like this:

http://dl.getdropbox.com/u/287197/Hierarchy%20Viewer.jpg   (the two
modules are surrounded by a border)

Do I really have to put a dummy (spacer) view between the two
LinearLayouts or is there another possibility?

Regards and thanks for your help.
--~--~---------~--~----~------------~-------~--~----~

2. Adding new contacts from an application

Hi,

I am writing an application from which I need to update and write new
contacts to Contact database.

what would be the best way to do this?
i have read several posts in which people have tried doing this but
could not not succeed, so has anybody successfully done this?

thanks,
kartic
--~--~---------~--~----~------------~-------~--~----~

3. Adding record to Content Provider

4. android security software/malware softwar

5. CHROOT problem

6. changing string resources

7. surfaceflinger different layers