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. QuickContact works fine on 2.2 but not on 2.1

 I have a ListView where I want to show the QuickContact (like in the 
default Contacts android app when you click on the photo of a contact).


It works fine on my Nexus One 2.2 or the emulator with avd 2.2, but doesn't work on my Samsung Galaxy S 2.1update1 or emulator 2.1. On 2.1, I'm getting the error: android.content.ActivityNotFoundException: No Activity found to handle Intent { act= com.android.contacts.action.QUICK_CONTACT dat=content://contacts/people/2177 This is the call in the code: public final void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) { ContactSummary summary = (ContactSummary) parent.getItemAtPosition(position); // Quick Contact Badge ContentValues values = new ContentValues(); values.put(Contacts.People.NAME, summary.formattedName); Uri uri = getContentResolver().insert(Contacts.People.CONTENT_URI, values); ContactsContract.QuickContact.showQuickContact(this.getApplicationContext(), view, uri, ContactsContract.QuickContact.MODE_MEDIUM, null); } --

2. Checkbox are not getting selected

Hi, I want to display list of items in my application and user will
select checkbox which is present in front of each item. List is
displayed well. It also shows checkbox infront of list item but when I
click on checkBox it is not getting selected. My code is like this

public void onCreate(Bundle icicle) {
                super.onCreate(icicle);

                String[] names = new String[] { "123", "234", "345", "456", 
"567",
"678", "789", "980};

                this.setListAdapter(new
ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice,
names));
        }

        @Override
        protected void onListItemClick(ListView lv, View v, int pos, long id)
{
                super.onListItemClick(lv, v, pos, id);

                Object obj = this.getListAdapter().getItem(pos);
                String keyword = obj.toString();
                Toast.makeText(this, "User selected: " + keyword, 
Toast.LENGTH_LONG)
                                .show();

        }

what's wrong in this code?

Thanks in advance

-- 

3. Unable to sign jar

4. Follow up for the active install count problem

5. Android - landscape-right and landscape-left orientation

6. running android filesystem on normal linux

7. chnges required in filesystem to run froyo