thể trùng lặp:
How to add new contacts in androidLàm thế nào để tạo một số liên lạc lập trình
public boolean createContact(String name, String number, String email)
{
boolean success = true;
try
{
ContentValues contentValues = new ContentValues();
ContentResolver contentResolver = getContentResolver();
contentValues.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
contentValues.put(Phone.NUMBER, "123254");
Uri uri = contentResolver.insert(android.provider.ContactsContract.Data.CONTENT_URI, contentValues);
if(uri==null)
{
success = false;
}
}
catch (Exception e)
{
e.printStackTrace();
success = false;
}
return success;
}
Tôi nhận NullPointer Exception Tôi không biết tại sao tôi cũng đã xác định WRITE_CONTACTS Permission. Xin hãy giúp tôi ............
Tôi không muốn sử dụng ** android.provider.Contacts ** i muốn tạo liên hệ bằng cách sử dụng ** android.provider.ContactContracts ** –
chúc may mắn http://stackoverflow.com/questions/4744187/ làm cách nào để thêm địa chỉ liên hệ mới trong Android – lnu
phiên bản SDK nào bạn đang sử dụng? –