1

I want an acitivy to show a Contextual Action Bar, not normal ActionBar. The reason is that I show this activity in resonse for user long-clicking an item.

I know how to hide title and in general make the normal ActionBar look similar to CAB, but not quite. May be there is a simple way of doing it?

Update: My question is similar, but not a complete duplication of how to invoke the actionbars context menu like behavior question

The difference is that I dont want at all to show a "normal" ActionBar, always the one that looks like Contextual ActionBar.

The suggestion to move to ActionMode right in the activity onCreate. ActionMode.Callback onDestroyActionMode() that is called when ActionMode ends, we would simply finish() the activity. It is a good one and almost does it. There are two subtle problems with this approach.

One, there is an observable flicker when ActionBar shows and immediately goes to CAB. Second, the more substatial one is that there is no way to differentiate between edits that we want to "accept" and "decline". I would want checkmark mean that edits need to be accepted, and "back" button mean that edits need to be discarded. Unfortunately the suggested hack results in both routes ending with the call to onDestroyActionMode()

I could have added more CAB action items, for saving or exiting without saving, but this defeats the purpose of having separate editing activity.

Community
  • 1
  • 1
Michael Kariv
  • 1,421
  • 13
  • 20
  • 2
    Just start ActionMode in onCreate? – se_bastiaan Jan 22 '14 at 10:04
  • Cool idea, why that did not occur to me I know not. I'll try it and report back – Michael Kariv Jan 23 '14 at 10:35
  • Researching based on your idea as a answer, I found that my question is a dup of this one: http://stackoverflow.com/questions/6162595/how-to-invoke-the-actionbars-contextmenu-like-behavior – Michael Kariv Jan 23 '14 at 14:21
  • I have updated my question explaining where auto-staring ActionMode fails my purpose. Suggestions and opinions are welcome. I am sure I am doing something wrong - may be I miss a better design pattern. – Michael Kariv Jan 23 '14 at 14:47
  • What about changing the actionbar theme in the activity? So you would be able to make it totally custom. – se_bastiaan Jan 23 '14 at 18:49
  • Re: changing actionbar theme in the activity. I dont know how to make an item to be left-idented. May be it is possible, I just did not see examples to that effect. But thanks for yet another good pointer, I'll take a look – Michael Kariv Jan 24 '14 at 20:00

0 Answers0