2013-10-11 5 views
0

사용자 Google 캘린더에서 일정 세부 정보를 가져 와서 표시하려는 Android 앱을 개발 중입니다. 이걸 어떻게 달성 할 수있다? 당신이 올바른 방향으로 날 지점 수 있다면 그레타에 도움이 될 것입니다.Google 캘린더에서 일정 세부 정보 가져 오기

도와주세요! 감사!

답변

1

아래의 코드를 사용하여 캘린더 이벤트를 기기에서 가져 오면 작동하는 코드입니다.

private void getCalenderEvents() { 
     Cursor cursor =context.getContentResolver().query(Uri.parse("content://com.android.calendar/events"), 
       new String[] { "calendar_id", "title", "description", "dtstart", "dtend", "eventLocation" }, null, null, null); 
     cursor.moveToFirst(); 
     // fetching calendars name 
     String CNames[] = new String[cursor.getCount()]; 

    for (int i = 0; i < CNames.length; i++) { 

     rowDataEvents = new HashMap<String, String>(); 

     String eventTitle = cursor.getString(1); 
     String eventStartDate = cursor.getString(3); 
     String eventEndDate = cursor.getString(4)); 
     String eventDescription = cursor.getString(2); 
     String eventLocation = cursor.getString(5); 


     cursor.moveToNext(); 

    } 
    cursor.close(); 
} 
+0

안녕하세요 Pratik. 비슷한 종류의 코드를 사용하여 문제를 해결했습니다.하지만 ICS 버전 (4.0 이상) 위에있는 기기에 문제가있어 ICS 위의 기기에 대한 캘린더 일정 세부 정보를 가져올 수 없습니다. 당신이 그것으로 나를 도울 수 있다면 큰 도움이 될 것입니다. 미리 감사드립니다! – Dave

관련 문제