Android examples for Android OS:Calendar Contract
print Attendees from Calendar
import android.annotation.TargetApi; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.DatabaseUtils; import android.net.Uri; import android.os.Build; import android.provider.CalendarContract; import android.util.Log; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main{ private static final String TAG = CalendarUtil.class.getSimpleName(); public static void printAttendees(Context context) { runGenericQuery(context, "Attendees", CalendarContract.Attendees.CONTENT_URI); }/*from www . j av a 2 s . com*/ private static void runGenericQuery(Context context, String queryName, Uri queryUri) { // Run query Cursor cursor; ContentResolver cr = context.getContentResolver(); // Submit the query and get a Cursor object back. cursor = cr.query(queryUri, null, null, null, null); String cursorContent = DatabaseUtils.dumpCursorToString(cursor); if (cursor != null) { cursor.close(); } Log.i(TAG, "------- " + queryName + " cursorContent: \n" + cursorContent); } }