Android-주소록:연락처 추가

1936 단어 통신 록
//     ,    
    public void testAddContact()  {
    
    	String name[]={"   ","   ","   ","   ","   ","  ","    ","    ",
    			"   ", "   ","   ","    ","   ","    ","    ","   "
    			,"   ","   ","    ","    ","    ","    ","    " };
    	for(String ss:name)
    	{
    		//      ,   rawContactsId ,         
            ContentValues values = new ContentValues ();   
            //insert a null value  
            Uri rawContactUri = getContentResolver().insert(RawContacts.CONTENT_URI,values);   
            long rawContactsId = ContentUris.parseId(rawContactUri);   
          
            //               
            values.clear();   
            //A reference to the _ID that this data belongs to  
            values.put(StructuredName.RAW_CONTACT_ID,rawContactsId);   
            //"CONTENT_ITEM_TYPE" MIME type used when storing this in data table  
            values.put(Data.MIMETYPE,StructuredName.CONTENT_ITEM_TYPE);   
            //The name that should be used to display the contact.  
            values.put(StructuredName.DISPLAY_NAME,ss);   
            //insert the real values  
            getContentResolver().insert(Data.CONTENT_URI,values);   
            //       
            values.clear();   
            values.put(Phone.RAW_CONTACT_ID,rawContactsId);   
            //String "Data.MIMETYPE":The MIME type of the item represented by this row  
            //String "CONTENT_ITEM_TYPE": MIME type used when storing this in data table.  
            values.put(Data.MIMETYPE,Phone.CONTENT_ITEM_TYPE);   
            values.put(Phone.NUMBER,"1008611");   
            getContentResolver().insert(Data.CONTENT_URI,values);   
    	}
    	
    }

좋은 웹페이지 즐겨찾기