问题描述
我想创建一个Android应用程序,与谷歌日历界面。
我已经使用内容提供商<一个跟着教程href="http://$c$c.google.com/p/android-calendar-provider-tests/source/browse/trunk/src/com/androidbook/androidcalendar/CalendarActivity.java">here.这code部分解释here.
我对着下面的问题。
-
我创建了一个新的日历的 TestCalendar 的从我的笔记本电脑我在网上,并且将其标记为选择的。当我查询我的日历从应用程序,我可以看到这个新的日历,但它显示为未选中(选中= 0)。为什么这可能是发生什么建议?
-
从我的应用程序,我通过
添加事件到日历getContentResolver()插入(eventsUri,事件);
该事件被反映在手机的日历,但它不反映在在线版本。网上推这个新的赛事,我一定要在日历手动同步,或转动的自动同步的对,我认为是不正确的方式在其中应该是这样的。任何建议/链接,可以帮助?
1)你能转储你的日历,并发布结果?
注意:
Android的&LT; API拉特14,你必须设置选择= 1
安卓> API拉特14,你必须设置可见= 1(选择是不是不再可用)
转储:
光标= contentResolver.query(Uri.parse(CALENDAR_URI),NULL,NULL,NULL,NULL);
而(cursor.moveToNext()){
的for(int i = 0; I&LT; cursor.getColumnCount();我++){
Log.e(XXX,cursor.getColumnName(ⅰ)+:+ cursor.getString(ⅰ));
}
}
CALENDAR_URI =内容://com.android.calendar/calendars(因为升级Froyo)或内容://日历/(前升级Froyo)
2) http://stackoverflow.com/a/11652415/411951
I am trying to create an android app that interfaces with the Google Calendar.
I have followed the tutorial using content providers from here. Parts of this code are explained here.
I am facing the below issues.
I created a new calendar TestCalendar from my online from my laptop, and marked it as Selected. When I query for my calendars from the app, I can see this new calendar, but it is shown as unselected (selected=0). Any suggestions on why this could be happening ?
From my app, I add an event to the calendar by
getContentResolver().insert(eventsUri, event);
The event is reflected in the calendar on phone, but it is not reflected in the online version. To push this new event online, I have to manually Synchronize the calendar, or turn the Auto Sync on, which I believe is not the right way in which this should be done. Any suggestions/links which could help ?
1) Can you dump your calendar and post the result?
Notice:
Android < API Lvl 14 you must set selected = 1
Android > API Lvl 14 you must set visible = 1 (selected is not longer available)
Dump:
cursor = contentResolver.query(Uri.parse(CALENDAR_URI),null, null, null,null);
while (cursor.moveToNext()) {
for (int i = 0; i < cursor.getColumnCount(); i++) {
Log.e("XXX", cursor.getColumnName(i) + ": " + cursor.getString(i));
}
}
CALENDAR_URI = content://com.android.calendar/calendars (since Froyo) or content://calendar/ (before Froyo)
2) http://stackoverflow.com/a/11652415/411951
这篇关于使用谷歌日历Android应用 - 同步问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!