mod MIUI上联系人的选择

时间:2011-07-26 12:25:36

标签: android contacts

任何人都面临着在时尚MIUI中选择联系人的任务 这样做:

startActivityForResult(new Intent(Intent.ACTION_PICK, Phone.CONTENT_URI));
...

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Uri contactData=data.getData();

Cursor c = null;

        try {

            c = context.getContentResolver().query(contactData, null, null, null, null);

            while (c.moveToNext()) {
                String id = c.getString(c.getColumnIndex(Phone.CONTACT_ID));

                String name = c
                        .getString(c.getColumnIndex(Contacts.DISPLAY_NAME));
                String phone = c.getString(c.getColumnIndex(Phone.NUMBER));

                ....

            }           

        } finally {
            if (c != null && !c.isClosed())
                c.close();
        }

}

所以这个MIUI会转储几乎所有(可能全部)你的联系人列表

0 个答案:

没有答案