Zygote:错误关闭描述符libcore.io.ErrnoException:关闭失败:EBADF(错误的文件编号)

时间:2017-08-16 07:25:08

标签: android runtime-error

我收到这样的错误,以便通过手机取消联系人。当我点击联系人时,它显示如下错误。我需要显示电子邮件,地址等联系方式。

  

Zygote:错误关闭描述符                                                libcore.io.ErrnoException:close failed:EBADF(文件号错误)                                                    at libcore.io.Posix.close(Native Method)                                                    在libcore.io.BlockGuardOs.close(BlockGuardOs.java:75)                                                    在com.android.internal.os.ZygoteInit.closeServerSocket(ZygoteInit.java:224)                                                    在com.android.internal.os.ZygoteConnection.handleChildProc(ZygoteConnection.java:879)                                                    在com.android.internal.os.ZygoteConnection.runOnce(ZygoteConnection.java:242)                                                    在com.android.internal.os.ZygoteInit.runSelectLoop(ZygoteInit.java:705)                                                    在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)                                                    在dalvik.system.NativeStart.main(本地方法)

我的代码就是这样:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent 

data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode)
        {
            case (PICK_CONTACT) :
                if (resultCode == Activity.RESULT_OK) {
                    Uri contactData = data.getData();
                    Cursor contactCursor = getContentResolver().query(contactData, new String[] { ContactsContract.Contacts._ID }, null, null, null);
                    String id = null;
                    if (contactCursor.moveToFirst()) {`enter code here`
                        id = contactCursor.getString(contactCursor.getColumnIndex(ContactsContract.Contacts._ID));
                    }
                    contactCursor.close();
                     phoneNumber = null;
                    Cursor phoneCursor = getContentResolver().query(
                            ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                            new String[] { ContactsContract.CommonDataKinds.Phone.NUMBER },
                            ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "= ? ",
                            new String[] { id }, null);
                    if (phoneCursor.moveToFirst()) {
                        phoneNumber = phoneCursor.getString(phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                    }
                    phoneCursor.close();
                }
                break;
        }
    }

我需要在代码中更改

0 个答案:

没有答案