我想通過Java應用程序從Google日曆發送短信。我創建了一個Java桌面應用程序,並將庫文件gdata-calendar-2.0.jar
,gdata-client-1.0.jar
添加到庫中。如何從Java應用程序使用Google日曆?
在那之後,我創建按鈕並粘貼此代碼在jButton1ActionPerformed
:
CalendarService myService = new CalendarService("exampleCo-exampleApp-1.0");
myService.setUserCredentials("[email protected]", "pa$$word");
URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/allcalendars/full");
CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);
System.out.println("Your calendars:");
System.out.println();
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
System.out.println("\t" + entry.getTitle().getPlainText());
}
我有這些進口:
import com.google.gdata.client.calendar.*;
import com.google.gdata.data.calendar.*;
,但它顯示在setUserCredentials無法找到符號,getEntries() getTitle()。