android phone contact
<p>i need to read organization name from phone contacts in 2.1 i can read name and phone number using following code</p>

<pre><code>         Cursor cur = User.cr.query(ContactsContract.Contacts.CONTENT_URI, null,  
                 null, null, null);  

         if (cur.getCount() &gt; 0) {  

             while (cur.moveToNext()) {  

                 // ID AND NAME FROM CONTACTS CONTRACTS  
                 String id = cur.getString(cur  
                         .getColumnIndex(ContactsContract.Contacts._ID));  
                 String name = cur  
                         .getString(cur  
                                 .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));  

   //              Log.i("Pratik", "ID :" + id);  
    //             Log.i("Pratik", "NAME :" + name);  

                 // GET PHONE NUMBERS WITH QUERY STRING  

                 if (Integer  
                         .parseInt(cur  
                                 .getString(cur  
                                         .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) {  
                     Cursor pCur = User.cr.query(  
                             ContactsContract.CommonDataKinds.Phone.CONTENT_URI,  
                             null,  
                             ContactsContract.CommonDataKinds.Phone.CONTACT_ID  
                                     + " = ?", new String[] { id }, null);  

                     // WHILE WE HAVE CURSOR GET THE PHONE NUMERS  
                   HashMap tempMap=new HashMap();
                     while (pCur.moveToNext()) {  
                         // Do something with phones  
                          phone = pCur  
                                 .getString(pCur  
                                         .getColumnIndex(ContactsContract.CommonDataKinds.Phone.DATA));  

                         String phoneType = pCur  
                                 .getString(pCur  
                                         .getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE));  


                       tempMap.put(phoneType, phone);
                     }  
                    pCur.close();
                    if(name!=null&amp;&amp;tempMap!=null)
                  if (!(Pattern.matches("^[A-Za-z0-9.\\-]+.[A-Za-z0-9.\\-]+\\.[A-Za-z]{2,4}$",name)))
                  { User.provider_name_phoneno.put(name, tempMap);
                    User.phoneContactName.add(name);
                 } 
                 }

             }  
         }  
</code></pre>
