andreas wrote:
> 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?
What you are doing wrong is trying to use things that are not part of
the SDK. These sorts of problems are going to happen.
http://www.androidguys.com/2009/12/14/code-pollution-reaching-past-the-sdk/
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
_The Busy Coder's Guide to Android Development_ Version 3.0
Available!
--
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