Android how to send multiple contacts are attached in single .vcf file and send to mail?

后端 未结 2 1470
深忆病人
深忆病人 2020-12-09 21:33

In my application, a number of contacts are attached to single .vcf file and that file sent to mail, try to this one all contacts data display in log cat, b

2条回答
  •  粉色の甜心
    2020-12-09 22:19

    finally my issue is solved using like this

         public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);     
    
         mContext = this; 
    
         button = (Button) findViewById(R.id.send);          
         button.setOnClickListener(new OnClickListener() {          
            public void onClick(View v) {        
                data();
            }
        });                      
    
        /**
         * This Function For Vcard And here i take one Array List in Which i
         * store every Vcard String of Every Contact Here i take one Cursor and
         * this cursor is not null and its count>0 than i repeat one loop up to
         * cursor.getcount() means Up to number of phone contacts. And in Every
         * Loop i can make vcard string and store in Array list which i declared
         * as a Global. And in Every Loop i move cursor next and print log in
         * logcat.
         * */
        getVcardString();           
    }       
    
     public static void getVcardString() {   
    
        String path = null;     
        String vfile = null;
    
         vfile = "Contacts.vcf";           
        Cursor phones = mContext.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,
                        null, null, null);
    
        phones.moveToFirst();
        Log.i("Number of contacts", "cursorCount" +phones.getCount());  
        for(int i =0;i

提交回复
热议问题