Hello, I'm using Dmitri's code but am getting the following error:
ERROR/AndroidRuntime(529): Caused by: android.database.sqlite.SQLiteException: near ".": syntax error: , while compiling: SELECT display_name, data1 FROM view_data_restricted data WHERE (1) AND (mimetype=vnd.android.cursor.item/contact_event AND data2=3) ORDER BY display_name Anyone know what could be causing this? On Mar 11, 2:50 pm, 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%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] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

