On Sep 4, 3:57 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> Write about it in a chapter in my book.

Ah!  I'm not sure how much this one is worth covering, but anyway. :)

> These sort of "introspection" mechanisms (e.g., addIntentOptions(), the
> discarded ActivityAdapter/ActivityIconAdapter) are one of the more
> interesting aspects of Android-dom, leading to lots of potential for
> inter-activity cooperation.

Yep, this is definitely an important area, that the faster people can
really understand them the more powerful our applications will
become.  This particular action is a really simple special-case one,
though, so I wouldn't recommend using it as an illustration of the
larger picture.

> For the book example, I was going to have the user ACTION_PICK a contact
> and then pick an operation via ACTION_PICK_ACTIVITY. That's because
> keeping book examples short and sweet makes it easier for people to grok
> the implementation. And, contacts are one content provider I know will
> be on the emulator and can trivially be added by the user so there's
> some real data there. So, yes, it's a mildly fakey example, but, gimme a
> break, it's a book...

Actually I don't think I would structure the example that way -- it
isn't really the kind of UI flow you would do, so this isn't how the
action is intended to be used.  What it is mainly used for is when you
want to pop up a list of things for the user to choose from to fill in
a field.  For example, if you were going to write a shortcut manager,
you could use ACTION_PICK_ACTIVITY to have the user pick an activity
to assign to a shortcut.  If the Intent extra you give it is
action=MAIN category=LAUNCHER they will be picking from all of the
"applications" they have installed.

For the case of picking a contact and then do something with it,
probably what you want to use is a chooser -- see
http://code.google.com/android/reference/android/content/Intent.html#ACTION_CHOOSER

This presents to the user a list of activities that match the given
intent (if there is more than one) and upon selecting one of them
executes that activity on the caller's behalf.  This is intended for
things like having the user add an attachment to an e-mail message
(where you want to present a list of things that can supply
attachments), so I think it better follows the example you want, and
should be used far more than the PICK_ACTIVITY action.

> I suppose I'll just delve deeper into
> PackageManager#queryIntentActivityOptions() instead. I prefer to put in
> more details on the more "cooked" approaches than the raw one, but if
> ACTION_PICK_ACTIVITY is DOA, and ActivityAdapter/ActivityIconAdapter are
> nuked, I may as well cover what I can.

Instead of queryIntentActivityOptions(), I would suggest using the
higher-level menu apis:
http://code.google.com/android/reference/android/view/Menu.html#addIntentOptions(int,%20int,%20int,%20android.content.ComponentName,%20android.content.Intent[],%20android.content.Intent,%20int,%20android.view.MenuItem[])

The note pad example should be using this for its menus.

To be honest, though, for our current UI we have pretty much backed
away from the menu approach, and I think all of the regular apps are
now using ACTION_CHOOSER for places where their actions can be
extended.  The chooser approach seems to work a bit better for
scalability in the places we have been using it.

--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to