2013-06-13 68 views
1

我一直在试图让我的安装装置,此代码对谷歌日历的ID:获取日历标识

String[] projection =       
           new String[]{       
            Calendars._ID,       
            Calendars.NAME,       
            Calendars.ACCOUNT_NAME,       
            Calendars.ACCOUNT_TYPE};        
         Cursor calCursor =       
           getContentResolver().      
            query(Calendars.CONTENT_URI,        
              projection,       
              Calendars.VISIBLE + " = 1 ",        
              null,        
              Calendars._ID + " ASC");       
         if (calCursor.moveToFirst()) {       
          do {       
           long id = calCursor.getLong(0);       
           String displayName = calCursor.getString(1);       
           // ... 
           textView1.setText(displayName + id); //outputs display name and id 

          } while (calCursor.moveToNext()); 

但它只是返回三星日历的名称和ID。 任何人都可以向我解释为什么?谢谢。

回答

1

// ..意味着你可以得到其他细节自己 例如

long id = calCursor.getLong(0); 

String displayName = calCursor.getString(1); 

String descriptions = calCursor.getString(2); 

你可以添加更多,如果你想了解更多详情.. 检查这个link