开发者

problem starting activity in android

I have an issue starting a new activity. I would like to start an activity so that the user can pick a list of contacts his/her contact list. This is what i have to start an intent, its triggered by a button click.

Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_LOOKUP_URI);
startActivityForResult(intent, kPickContact);

I get this error

09-14 01:34:04.402: ERROR/ActivityManager(106): java.lang.IllegalArgumentException: URI: content://com.android.contacts/contacts/lookup, calling user: android.uid.system:1000, calling package is one of: [com.google.android.backup, com.android.providers.settings, com.android.systemui, com.android.providers.subscribedfeeds, com.android.settings, android, com.android.server.vpn]
09-14 01:34:04.402: ERROR/ActivityManager(106):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:144)
09-14 01:34:04.402: ERROR/ActivityManager(106):     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114)
09-14 01:34:04.402: ERROR/ActivityManager(106):     at android.content.ContentProviderProxy.getType(ContentProviderNative.java:387)
09-14 01:34:04.402: ERROR/ActivityManager(106):     at com.android.server.am.ActivityManagerService.getProviderMimeType(ActivityManagerService.java:5586)
09-14 01:34:04开发者_JS百科.402: ERROR/ActivityManager(106):     at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:1267)
09-14 01:34:04.402: ERROR/ActivityManager(106):     at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1467)

I hate dumping error logs here, but i am so new to android i have no idea how to parse this crash log. Can someone a) give me insight into what i am doing wrong and b) point me to some resources as to how to read these crash logs?


You can get the list of the contacts to use this query.

  Cursor cursor = getContentResolver().query(
            ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
            new String[] { Phone._ID, Phone.DISPLAY_NAME, Phone.NUMBER },
            null, null, null);

    startManagingCursor(cursor);
    cursor.moveToFirst();
    cursor.getColumnCount();

    for (int i = 0; i < cursor.getCount(); i++) {
        contactName.add(cursor.getString(1));

        cursor.moveToNext();
    }


I may be too late but hope to be of help to someone...

Instead of Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_LOOKUP_URI); you should use Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);

Though from the docs it is advised to use Contacts.CONTENT_LOOKUP_URI

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜