Fetch from phone book - crashes

by RAJENDIRAN SUNDARRAJAN-CPB738 » Tue, 18 Nov 2008 23:11:29 GMT


Sponsored Links
 Hi 
 
I was trying to fetch the contact number and name from the phone book.
But while querying for the content, it crashes. Below is the code that I
was using. 
 
ContentResolver cont = getContentResolver();

Cursor c = cont.query(Phones.CONTENT_URI, null, null, null, null);  //
crashes here

startManagingCursor(c); 

// Create an array to specify the fields we want to display in the list
(only TITLE)

String[] from = new String[]{Phones.NAME};

// and an array of the fields we want to bind those fields to (in this
case just text1)

int[] to = new int[]{R.id.text1};

ListAdapter adapter = new
SimpleCursorAdapter(this,R.layout.contacts_row,c,from,to );

setListAdapter(adapter);

 

Thanks

Sundar


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. how to get source code

Dear sir,

     kindly post me clearly how to get source code of a particular
application in ubuntu

--~--~---------~--~----~------------~-------~--~----~

2. Suggestion for building a solid IM client

> As many developers know already, Android automatically closes the 7th

This may be the behavior you've observed, but this is not how resource
decisions are made. Applications are kept running as along as possible
until the system hits memory limits. It might be sooner than the 7th
app, it might be later. This behavior might also change in the future
due to different hardware or changes to how memory allocation
decisions are made. The best thing to do is realize that your
application may die at any time, if its not in the foreground.


Yes, this is how you should do any background processing (which an IM
application almost certainly wants). You also want to run this as a
*remote* service, so the system can kill the process hosting the UI.

Cheers,
Justin
Android Team @ Google

On Oct 22, 11:19pm, "[EMAIL PROTECTED]"


--~--~---------~--~----~------------~-------~--~----~

3. SIP for Android.

4. Procedure to install the android application into to Mobile Device.....

5. Computers

6. New Maps API TOS'

7. JRuby