get all .vcf file in a single folder
<p>i am making .vcf file off all contacts stored in contacts list and save it in sdcard as well but all .vcf file are storing sepratly in my SDCARD , iwant to make a folder in side Sdcard and save all the .vcf file inside it...and finally get the path of folder and able to mail it in email id..so how to make a folder to save all .vcf file inside it if there are thousands of contacts in contact list of my device.</p>

<p>my code for making .vcf and save it in sdcard are below. pls modified on the same or provide some new idea...</p>

<pre><code> private void getVcardString() {
             int j=0;
                // TODO Auto-generated method stub
                vCard = new ArrayList&lt;String&gt;();
                cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
                if(cursor!=null&amp;&amp;cursor.getCount()&gt;0)
                {
                    cursor.moveToFirst();
                    for(int i =0;i&lt;cursor.getCount();i++)
                    {
                        get(cursor);
                        Log.d("TAG", "Contact "+(i+1)+"VcF String is"+vCard.get(i));
                        publishProgress(Integer.toString(j));        
                        j++;
                        cursor.moveToNext();
                    }
                    csv_status = true;
                   }
                else
                {
                    Log.d("TAG", "No Contacts in Your Phone");
                }

         }
       public void get(Cursor cursor)
            {
                vfile = "Contacts" + "_" + System.currentTimeMillis()+".vcf";

                //String vfile = "Contacts"+".vcf";
                //cursor.moveToFirst();
                String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
                Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
                AssetFileDescriptor fd;
                try {
                    fd = CsvSender.this.getContentResolver().openAssetFileDescriptor(uri, "r");
                    FileInputStream fis = fd.createInputStream();
                    byte[] buf = new byte[(int) fd.getDeclaredLength()];
                    fis.read(buf);
                    String vcardstring= new String(buf);
                    vCard.add(vcardstring);
                    String storage_path = Environment.getExternalStorageDirectory().toString() + File.separator + vfile;
                    FileOutputStream mFileOutputStream = new FileOutputStream(storage_path, false);
                    mFileOutputStream.write(vcardstring.toString().getBytes());
                }catch (Exception e1) 
                {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
            }
</code></pre>
