简体   繁体   中英

Edit Contact URI is not working in android 4.0 and above

I have developed one code to edit contact but it is not working in the android 4.0 and above. Activity of edit is starting but closes immediately and backs to the parent activity.Do not know what is the problem, here is my code:

Intent i = new Intent(Intent.ACTION_EDIT);
i.setData(Uri.parse(ContactsContract.Contacts.CONTENT_LOOKUP_URI
                                                + "/" + contactId[position]));
int REQUEST_CODE = 2;
startActivityForResult(i, REQUEST_CODE);

Any solution will be appreciated.

After researching and made one solution of the above problem is as below:

Intent i = new Intent(Intent.ACTION_EDIT);
i.setData(Uri.parse(ContactsContract.Contacts.CONTENT_URI
                                            + "/" + contactId[position]));
int REQUEST_CODE = 2;
startActivityForResult(i, REQUEST_CODE);

you just need to use content_uri instead of content_lookup_uri.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM