안드로이드 개발 질문/답변
(글 수 45,052)
아무리 찾아봐도 안나오네요 ㅠㅠ
The code above creates an array of strings containing the names and an array of integers containing the calendar_ids of all available calendars.
1달 달력처럼 1일부터 말일까지 한번에 주욱 나와있는 달력api는 없나요?
제가 구글링으로 찾은 calendar 튜토리얼 중에
Cursor cursor = cr.query(Uri.parse("content://calendar/calendars"), new String[]{ "_id", "displayname" }, null, null, 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] = cursor.getString(1);
cursor.moveToNext();
}
cursor.close();
To actually add an event to a calendar, start by creating a ContentValues object
Put a calendar_id from the array above in there along with the title, date and location for the event.
It should look something like this:
Finally, write these values to the calendar like such:
Put a calendar_id from the array above in there along with the title, date and location for the event.
It should look something like this:
ContentValues cv = new ContentValues();
cv.put("calendar_id", CalIds[0]);
cv.put("title", myTitle);
cv.put("dtstart", startTime);
cv.put("dtend", endTime);
cv.put("eventLocation", myLocation);
cr.insert(Uri.parse("content://calendar/events"), cv);
이런 소스가 있는데 첫줄에 cr.query에서 cr이 뭔가요?
cursor로 바꾸면 query라는 메서드가 안나오던데요 ㅠㅠ
저두 달력에 대한 소스를 찾아보았는데~ 결국 만들었습니다. getView 를 써서 만들면 되더라구요 ^^;;
아마도 버젼업 되면서 없어진듯한데요~ 많은 정보를 못드려 죄송합니다.