Sorry, but the above answer is misleading.  First of all, it uses obsolete
API. Second, it returns phone numbers, not birthdays. You should use the
Data.CONTENT_URI and constrain the mime type to Event.  And then you should
do some magic about parsing dates, because we don't impose any format.  So
it can be basically any string (exchange sync adapter is using a ISO
standard format, but gmail does not)

Cheers,
Dmitri

On Mar 10, 2010 12:41 AM, "SREEHARI" <[email protected]>
wrote:



Use the below code to display all contacts with their number

package com.wipro.address;

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Contacts.Phones;
import android.provider.Contacts.People;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;
import android.net.Uri;


public class Address extends ListActivity
{
       public static Uri myURI = Uri.parse("content://homeprovider/
homeprofiles");

       @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);

       Cursor c = getContentResolver().query(Phones.CONTENT_URI,
null, null, null, null);
       startManagingCursor(c);
       ListAdapter adapter = new SimpleCursorAdapter(this,

 android.R.layout.simple_list_item_2,
                                         c,
                             new String[] { Phones.NAME,
Phones.NUMBER },
                             new int[] { android.R.id.text1,
android.R.id.text2 });
       setListAdapter(adapter);

}

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Dev...

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to