Hi,
I have written some code to read all calendars synced to the phone,
based on serveral examples found online:
public static void init(Activity act) {
String[] projection = new String[] { "_id", "displayName" };
Uri calendars = Uri.parse("content://calendar/calendars");
Cursor managedCursor = act.managedQuery(calendars,
projection,"selected", null, null);
anzahl=0;
if (managedCursor.moveToFirst()) {
int nameColumn =
managedCursor.getColumnIndex("displayName");
int idColumn = managedCursor.getColumnIndex("_id");
do {
name[anzahl] = managedCursor.getString(nameColumn);
id[anzahl] =
QuickAddroid.MyToInt(managedCursor.getString(idColumn));
anzahl++; */
} while (managedCursor.moveToNext());
}
}
This works perfectly on my G1, but users with HTC Desire and Hero mail
me, that they get a FC at the point of the program, when the array
name[] and id[] is used. I guess there is a null-pointer in name,
because somehow the calendars are not read using this phones (android
1.5, android 2.1).
Any hint what I am doing wrong?
Greetings,
Andreas
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe, reply using "remove me" as the subject.