0

我正在尝试为 android 开发一个应用程序,我需要在其中获取保存在手机日历中的所有日历条目(提醒),我该如何获取它们?我可以在android模拟器上做吗?

4

2 回答 2

0

GData 已被弃用,并且与许多 Android 版本不兼容。

阅读本文会有所帮助。

于 2012-01-17T17:54:45.593 回答
-1

我得到了这个代码。看,它可能对你有帮助

Cursor cursor = cr.query(Uri.parse("content://calendar/events"), new String[]{ "calendar_id", "title", "description", "dtstart", "dtend", "eventLocation" }, null, null, null);         
    //Cursor cursor = cr.query(Uri.parse("content://calendar/calendars"), new String[]{ "_id", "name" }, null, null, null);
    String add = null;
    cursor.moveToFirst();
    String[] CalNames = new String[cursor.getCount()];
    int[] CalIds = new int[cursor.getCount()];
    for (int i = 0; i < CalNames.length; i++) {
        CalIds[i] = cursor.getInt(0);
        CalNames[i] = "Event"+cursor.getInt(0)+": \nTitle: "+ cursor.getString(1)+"\nDescription: "+cursor.getString(2)+"\nStart Date: "+new Date(cursor.getLong(3))+"\nEnd Date : "+new Date(cursor.getLong(4))+"\nLocation : "+cursor.getString(5);
        if(add == null)
            add = CalNames[i];
        else{
            add += CalNames[i];
        }           
        ((TextView)findViewById(R.id.calendars)).setText(add);

        cursor.moveToNext();
    }
    cursor.close();
于 2011-08-09T10:43:20.157 回答