Code snippets provided on this mailing list are often sketches or ideas
without the expectation that they would work by simply copying and pasting.
mResolver in the above snippets is assumed to have been initialized like
this:
ContentResolver mResolver;
onCreate() {
...
mResolver = getContentResolver();
...
}
The above, again, is a sketch.
Cheers,
- Dmitri
On Fri, Mar 12, 2010 at 8:15 AM, Nox <[email protected]> wrote:
> Thank you for your replies but I´ve still a problem.
> I´ve pasted the last code from Dmitri Plotnikov into my project but
> Eclipse doesn´t know what mResolver is.
> Do you know how to fix this problem?
>
> By the way, I tried the code from Karan too, but there I have the same
> problem with mResolver and another problem with "where" ( in the first
> line ).
>
>
>
>
>
>
>
>
> On 11 Mrz., 19:50, Dmitri Plotnikov <[email protected]> wrote:
> > Nice, but this might be even better:
> >
> > Cursor cursor = mResolver.query( Data.CONTENT_URI,
> > new String[]{Event.DISPLAY_NAME, Event.DATA},
> > Data.MIMETYPE + "=" + Event.CONTENT_ITEM_TYPE + " AND " + Event.TYPE
> +
> > "=" + Event.TYPE_BIRTHDAY,
> > null,
> > Data.DISPLAY_NAME );
> > if( cursor != null ) {
> > try {
> > while( cursor.moveToNext() ) {
> > String displayName = cursor.getString(0);
> > String date =cursor.getString(1);
> > }
> > } finally {
> > cursor.close();
> > }
> >
> >
> >
> > }
> > On Wed, Mar 10, 2010 at 11:12 PM, Karan <[email protected]> wrote:
> > > Use the following code to read the data.
> >
> > > Cursor cursor = mResolver.query( Data.CONTENT_URI, null, where, null,
> > > Data.DISPLAY_NAME );
> > > if( cursor != null ) {
> > > while( cursor.moveToNext() ) {
> > > String rawContactID =
> > > cursor.getString( cursor.getColumnIndex( Data.RAW_CONTACT_ID ) );
> > > String mimetype =
> > > cursor.getString( cursor.getColumnIndex( ContactsContract.Data.MIMETYPE
> )
> > > );
> > > if( mimetype.equals( StructuredName.CONTENT_ITEM_TYPE ) ) {
> > > // Read name : Field = StructuredName.DISPLAY_NAME
> > > }
> > > else if( mimetype.equals( Relation.CONTENT_ITEM_TYPE ) ) {
> > > // Read birthdate : Field = Relation.DATA
> > > }
> > > // Note : The name and the birthday will be there in different
> > > entries
> > > // So make sure that you match them properly and maintain it
> > > accordingly
> > > }
> > > }
> >
> > > On Mar 10, 11:38 pm, Mark Murphy <[email protected]> wrote:
> > > > Nox wrote:
> > > > > Thank you for your replies,
> > > > > but unfortunately it doesn t work.
> > > > > If I open my app there ll appear the error message:
> >
> > > > > The application has stopped unexpectedly. Please try again.
> >
> > > > > Do you know what I have to do now?
> >
> > > > Use adb logcat, DDMS, or the DDMS perspective in Eclipse to look at
> the
> > > > Java stack trace that was generated when that dialog appeared. It
> should
> > > > give you some clues for fixing your problem.
> >
> > > > --
> > > > Mark Murphy (a Commons Guy)http://commonsware.com|
> > >http://twitter.com/commonsguy
> >
> > > > _The Busy Coder's Guide to *Advanced* Android Development_
> > > > Version 1.3 Available!
> >
> > > --
> > > 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]<android-developers%[email protected]><android-developers%2Bunsubs
> [email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
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