2012-04-18 3 views
1

캘린더에서 이벤트를 가져 오는 데 this 코드를 사용하고있었습니다.캘린더에서 이벤트 가져 오기 관련 문제

request time failed: java.net.SocketException: Address family not supported by protocol 

나는이 선에 그 코드 충돌을주의 디버깅 :

Cursor eventCursor = contentResolver 
        .query(builder.build(), new String[] 
        { "title", "begin", "end", "allDay" }, 
          "Calendars._id=" + 1, null, 
          "startDay ASC, startMinute ASC"); 

System.out.println("eventCursor count=" + eventCursor.getCount()); 

어떤 생각이 도움이 될 것입니다

는하지만 오류 같은을 얻었다. 감사.

답변

1

OS 버전에 오류가 발생했습니다. SDK-7을 사용 중일 수 있습니다. 이 코드를 대신 사용해보십시오.

Uri.Builder builder; 
     if (android.os.Build.VERSION.SDK_INT <= 7) 
     { 
     // the old way 
     builder = Uri.parse("content://calendar/instances/when").buildUpon(); 
     } else 
     { 
     // the new way 
     builder = Uri 
     .parse("content://com.android.calendar/instances/when").buildUpon(); 
     } 

정상적으로 작동합니다.

+1

감사합니다. – asish

관련 문제