On Mon, Sep 26, 2011 at 8:06 AM, MrArti <[email protected]> wrote:
> Is it possible to activate the selection mode on a ListView configured
> with CHOICE_MODE_MULTIPLE_MODAL from an option item ? The default
> behavior is to do a long click on the list but I would like to achieve
> the same with a button in the ActionBar.

Off the cuff, that should work. Just call startActionMode() when the
user clicks the action bar button.

> I've tried to reproduce the ActionMode with the following ActionMode
> callback started when the user clicks on the button but the items's
> selection state isn't reset when the ActionMode is destroyed and they
> still appeared checked.

Assuming that by "when the ActionMode is destroyed" you mean when the
user clicks the Done button, I have seen that same issue and I have
not determined yet how to get past it.

For cases where you finish() the action mode, you can call
clearChoices() in onDestroyActionMode(). However, the Done button does
not seem to invoke onDestroyActionMode() in the testing I have done to
date.

Also, note that you are calling
setChoiceMode(ListView.CHOICE_MODE_MULTIPLE) instead of
setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL).

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

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.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

Reply via email to