well, with an awnser like that any disucssion group is useless. Maybe there is 
someone out there who has a hint?

-----Ursprüngliche Nachricht-----
Von: "Kumar Bibek"  
Gesendet: 22.10.2010 22:42:11
An: "Android Developers"  
Betreff: [android-developers] Re: Querying Content Providers

>Well, you should be able to find all your answers in the
>documentation. If you don't find it there, then you can only rely on
>whatever eclipse prompts you to use.
>
>On Oct 21, 5:28 pm, andyandroid   wrote:
>> Hi,
>>
>> I want to query a content provider, e.g. contacts. (API 2.x). I create
>> a cursor like this
>>
>> Cursor cursor =
>> getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
>> null, null, null, null);
>>
>> Now I have an internal table represented by this cursor and I can
>> browse through this table with the aid of that cursor. In order to
>> know what data I have I need to know the columns of my table, I assume
>> in my case these
>>
>> http://developer.android.com/reference/android/provider/ContactsContr...
>>
>> are the columns I have available and I can pick from. So lets try this
>>
>>         while(cursor.moveToNext())
>>         {
>>                 String data =
>> cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.XXXXXXXX));
>>                 Log.e("myTag", data);
>>
>>         }
>>         cursor.close();
>>
>> I would assume that where I have typed XXXXXXXX that I can enter any
>> column from the link above, so for example
>>
>> String data =
>> cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME_PRIMARY));
>>
>> Eclipse auto complete does not offer me a DISPLAY_NAME_PRIMARY but a
>> DISPLAY_NAME. Using DISPLAY_NAME seems to work. So the question is, am
>> I just lucky to get the data and in fact I haven't understood
>> something? Or is that a plain bug in the documentation?
>>
>> The biggest problem is that it seems to be worse for other providers,
>> e.g.http://developer.android.com/reference/android/provider/ContactsContr...
>> , this
>>
>> Cursor groupC =
>> getContentResolver().query(ContactsContract.Groups.CONTENT_URI, null,
>> null, null, null);
>>         while(groupC.moveToNext())
>>         {
>>          String group =
>> groupC.getString(cursor.getColumnIndex(ContactsContract.Groups._ID));
>>                  Log.e("myTag", group); //
>>         }
>>         groupC.close();
>>
>> works fine. It prints number 1....6 hence I assume I have 6 entries in
>> my table (though I only have 5 contacts groups in my contact
>> application). But this:
>>
>> Cursor groupC =
>> getContentResolver().query(ContactsContract.Groups.CONTENT_URI, null,
>> null, null, null);
>>         while(groupC.moveToNext())
>>         {
>>          String group =
>> groupC.getString(cursor.getColumnIndex(ContactsContract.Groups.TITLE));
>>                  Log.e("myTag", group); //
>>         }
>>         groupC.close();
>>
>> Leads to a crash "Caused by: java.lang.IllegalStateException: get
>> field slot from row 0 col -1 failed".
>>
>> Anyone who can shed some light on this problem?
>>
>> Thanks.
>> A.
>
>-- 
>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
___________________________________________________________
GRATIS! Movie-FLAT mit über 300 Videos. 
Jetzt freischalten unter http://movieflat.web.de

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