DulcetTone wrote:
> My app wants to whisk the user to the "create new event" composition
> window of his Calendar app, initializing begin time, end time, title
> and description text for the event, but then leaving him able to see
> these values and optionally alter them before saving (or discarding)
> the event using the oridinary means available to him from within the
> Calendar's create new event activity.
> 
> HOWEVER...
> 
> My code which works dandy on my own dev phone (indeed, on any phone
> running stock Android Calendar to the bone) fails on the HTC Hero.
> The issue is that the Hero has been "improved" by use of a non-
> standard Calendar app and my means of doing this is therefore failing.
> 
> I wonder if someone can outline a more generic means I can use to say
> "tell whatever the user's preferred Calendar app is to create a new
> event, seeding the effort with these key/value pairs".
> 
> Here is my present code:
> 
>       Intent intent = new Intent(Intent.ACTION_INSERT) ;
> 
>         // the HTC anti-Hero does not have a class named
> "com.android.calendar.EditEvent" :(
>       intent.setClassName
> ("com.android.calendar","com.android.calendar.EditEvent");
> 
>       intent.putExtra("beginTime", calObject.getTimeInMillis());
>         // make it 15 minutes duration
>       intent.putExtra("endTime", calObject.getTimeInMillis() + (1000 * 60 *
> 15));
> 
>       intent.putExtra("title", "dentist appointment");
>       intent.putExtra("description", "this would be the additional text
> describing the event");

There is no public API for that in the SDK. The technique you are using
goes past the bounds of the SDK (as evidenced by references to
"com.android.calendar"), and therefore may fail with some devices, with
newer versions of Android, with third-party calendar apps, etc.:

http://www.androidguys.com/2009/12/14/code-pollution-reaching-past-the-sdk/

Now, it would be nice if there were a consistent API for this, either in
the SDK or simply agreed to by calendar implementers. I'm not completely
clear how to try to arrange such coordination, though.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Beginning Android_ from Apress Now Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to