Hi,

I have one more question on this. The following query returns all the
contacts in the phone.

private String[] projection = new String[] {
       People._ID,
       People.NAME,
       People.NUMBER,
   };

       managedCursor = managedQuery(People.CONTENT_URI,
               projection,
               null,
               null,
               People.NAME + " ASC");

How do I modify this to get only the mobile numbers ? I am not
interested in the contacts that don't have mobile numbers. I am not
sure which column to project. I tried using TYPE and TYPE_MOBILEs but
no luck. Please let me know if you have any suggestions.

Thanks,
Sarath

On Fri, Dec 26, 2008 at 11:02 AM, prakarp <[email protected]> wrote:
>
> In your Android Manifest file, you need to configure explicit
> permissions for your application to read the Contacts database. In
> Eclipse, you can do this easily,, just click around with the
> AndroidManifest file.
>
> - p
>
> On Dec 26, 10:28 am, "Sarath Kamisetty" <[email protected]>
> wrote:
>> Hi,
>>
>> I am trying to write a simple application that displays the contents
>> of Contacts content provider in the phone. So far, I have only one
>> statement in this program (pasted below) and all it does is tries to
>> get a cursor over the contacts list. However, when I run the
>> application in the emulator, I see the following run time error on the
>> emulator screen:
>>
>> "Sorry! The application MyApp (process com.android.myapp) has stopped
>> unexpectedly. Please try again."
>>
>> How do I start debugging this ? Is there any debugger that can help ?
>> Any logs that I can look at ? Here is my test application.
>>
>> Thanks,
>> Sarath
>>
>> import android.app.Activity;
>> import android.database.Cursor;
>> import android.os.Bundle;
>> import android.provider.Contacts.People;
>>
>> public class MyApp extends Activity {
>>     // array specifying which columns to return.
>>     private String[] projection = new String[] {
>>         People._ID,
>>         People.NAME,
>>         People.NUMBER,
>>     };
>>     Cursor managedCursor;
>>
>>     /** Called when the activity is first created. */
>>     @Override
>>     public void onCreate(Bundle savedInstanceState) {
>>         super.onCreate(savedInstanceState);
>>
>>         managedCursor = managedQuery(People.CONTENT_URI,
>>                 projection,
>>                 null,
>>                 null,
>>                 People.NAME + " ASC");
>>     }
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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