On Sun, Oct 9, 2011 at 4:58 PM, Jean-Michel <jeanmichel.caz...@gmail.com> wrote:
> I found out how to get my menu back (target a SDK below 11)

Your options menu, with targetSdkVersion="11" or higher, will be in
the action bar, on the right.

> but I
> have been Googling for last 3 hours in order to discover how to get a
> search button in the action bar and I failed...

You have two choices. One says you use android:showAsAction and
android:actionLayout in your options menu XML, so on tablets you can
have a search field in the action bar itself and on phones it will
appear as a regular options menu item. Or, use setCustomView() on
ActionBar to add a search field when you are on API Level 11 or
higher, and do something else for older devices.

> So to make sure things are in perspective:
> - I'd like to have the same code accross the board

By definition, that's not strictly possible. You can have one code
base that supports both search-in-action-bar and other affordances,
but you will need to have some action bar-specific stuff somewhere.

> - I am using search to trigger a custom  action in a custom activity
> (still like a search, but not really a search).

Huh?

> - furthermore I am using long press on serach as well.

Huh?

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

Android 3.1 Programming Books: http://commonsware.com/books

-- 
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