How to parse Contact Vcard File from Sdcard in Android
<p>I am trying to parse Vcard file. here is my code.</p>

<pre><code>public void get_vcf_data(String file) throws VCardException, IOException{
         VCardParser parser = new VCardParser();
            VDataBuilder builder = new VDataBuilder();

            //String file = path;

            //read whole file to string
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    new FileInputStream(file), "UTF-8"));

            String vcardString = "";
            String line;
            while ((line = reader.readLine()) != null) {
                vcardString += line + "\n";
            }
            reader.close();

            //parse the string
            boolean parsed = parser.parse(vcardString, "UTF-8", builder);
            if (!parsed) {
                throw new VCardException("Could not parse vCard file: " + file);
            }

            //get all parsed contacts
            List&lt;VNode&gt; pimContacts = builder.vNodeList;

            //do something for all the contacts
            for (VNode contact : pimContacts) {
                ArrayList&lt;PropertyNode&gt; props = contact.propList;

                //contact name - FN property
                String name = null;
                String number = null;
                String tel = null;
                for (PropertyNode prop : props) {
                    if ("FN".equals(prop.propName)) {
                        name = prop.propValue;
                        Contact_name.add(name);
                        Log.d("Name", name);
                        //we have the name now
                        break;
                    }
                }
                for (PropertyNode prop : props) {
                    if ("N".equals(prop.propName)) {
                        number = prop.propValue;
                        Contact_number.add(number);
                        Log.d("Name", number);
                        //we have the name now
                        break;
                    }
                }
                for (PropertyNode prop : props) {
                    if(" TEL".equals(prop.propName))
                    {
                        tel = prop.propValue;
                        Contact_tel.add(tel);
                        Log.d("Name", tel);
                    }
                }
                Log.d("Tag", ""+Contact_name.size()+"::"+Contact_number.size()+"::"+Contact_tel.size());

                //similarly for other properties (N, ORG, TEL, etc)
                //...

                System.out.println("Found contact: " + name);
            }
}
</code></pre>

<p>but facing problem in while loop</p>

<pre><code>while ((line = reader.readLine()) != null) {
                vcardString += line + "\n";
            }
</code></pre>

<p>continuously looping inside a while loop and doesn't exit from loop once it is entered</p>
