Package COM. yarin. android. examples_03_02; import android. app. activity; import android. content. contentresolver; import android. database. cursor; import android. OS. bundle; import android. provider. contactscontract; import android. provider. contactscontract. phonelookup; import android. widget. edittext; import android. widget. textview; public class activity01 extends activity {public void oncreate (bundle savedinstancestate) {edittext edit = new edittext (this); string = ""; super. oncreate (savedinstancestate); // obtain the contentresolver object contentresolver Cr = getcontentresolver (); // obtain the cursor = CR for the first entry in the phone book. query (contactscontract. contacts. content_uri, null, null); // move the cursor down while (cursor. movetonext () {// get the contact name int namefieldcolumnindex = cursor. getcolumnindex (phonelookup. display_name); string contact = cursor. getstring (namefieldcolumnindex); // call String contactid = cursor. getstring (cursor. getcolumnindex (contactscontract. contacts. _ id); cursor phone = CR. query (contactscontract. commondatakinds. phone. content_uri, null, contactscontract. commondatakinds. phone. contact_id + "=" + contactid, null, null); While (phone. movetonext () {string phonenumber = phone. getstring (phone. getcolumnindex (contactscontract. commondatakinds. phone. number); string + = (contact + ":" + phonenumber + "\ n") ;}} cursor. close (); // set the content displayed in textview to edit. settext (string); // display to the screen setcontentview (edit );}}