在构建日历应用程序时,我有一个微调器来显示已同步的帐户列表。代码如下:我得到同步帐户列表。但是,“联系人'生日和事件”和“印度假期”的重播将是以下两次截图。 我的代码是:
final ContentResolver cr = ctx.getContentResolver();
Cursor cursor ;
if (Integer.parseInt(Build.VERSION.SDK) >= 9 )
{
cursor = cr.query(Uri.parse("content://com.android.calendar/calendars"), new String[]{ "_id", "name" }, null, null, "_id");
}
else
cursor = cr.query(Uri.parse("content://com.android.calendar/calendars"), new String[]{ "_id", "name" }, null, null, "_id");
if ( cursor.moveToFirst())
{
calNames = new String[cursor.getCount()];
final int[] calIds = new int[cursor.getCount()];
for (int i = 0; i < (calNames.length); i++)
{
calIds[i] = cursor.getInt(0);
calNames[i] = cursor.getString(1);
cursor.moveToNext();
}
}
MY SCREENSOT:
任何帮助都非常感谢并提前致谢...