如何使用谷歌日历api在Android中获取Google日历事件?

时间:2013-10-10 04:19:27

标签: android

我必须将Google日历中的活动转换为我自己的Android应用。我怎么能这样做?

这里我使用了gdata lib,但是在for迭代中我获得了一些id而不是tile。

提前致谢。

            DocsService client = new DocsService("myappname");
        try {
            client.setUserCredentials("example@gamil.com",
                    "pwd");

            URL feedUri = new URL(
                    "https://docs.google.com/feeds/default/private/full/");
            DocumentListFeed feed = client.getFeed(feedUri,
                    DocumentListFeed.class);

            // TextView textView = (TextView) findViewById(R.id.textView1);

            String text = "";
            for (DocumentListEntry entry : feed.getEntries()) {
                // text += entry.getTitle().getPlainText() + "\r\n";
                list.add(entry.getTitle().toString());

            }
            return list;
            // textView.setText(text);
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ServiceException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

2 个答案:

答案 0 :(得分:3)

您需要使用Calender Provider

对于活动,请查看以下链接:

http://developer.android.com/guide/topics/providers/calendar-provider.html#events

以下是一些博客和相同的解释

http://www.grokkingandroid.com/androids-calendarcontract-provider/

在此link中显示了如何在日历提供程序中阅读和编辑事件。

希望这会有所帮助......

答案 1 :(得分:1)