Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to parse Contact Vcard File from Sdcard in Android
    primarykey
    data
    text
    <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>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload