problem getting calender provider data

  • Replies:0
fabrice
  • Forum posts: 1

Jun 28, 2012, 11:00:13 PM via Website

hie,
i m trying to access user calenders and further check current events. until now i m only able to access the number of calender the user has. but i m failing to get out more data from cursor object. here is my code:
1int cal_number=0;
2 String[] projection = new String[] { "_id", "name" };
3 Cursor cursor =getContentResolver().query(Uri.parse("content://com.android.calendar/calendars"), projection, null, null, null);
4 cal_number=cursor.getCount();
5 hello.setText("number of cal :"+cal_number);
6 cursor.moveToFirst();
7 String col_names[]=cursor.getColumnNames();
8
9 while(cursor.moveToNext()){
10 hello.append(cursor.getString(2)); //trying to get the data from the third column... total failure...
11 hello.append("\n");
12
13 }

i can t figure out what s wrong....
help plz.....

Reply