Dmitriy Tarasov Dmitriy Tarasov - 1 year ago 70
Android Question

Get item view from ActionBar

I have an ActionBarSherlock with one menu item in my bar. When I'm call

View item = findViewById(;
in activity's button
all works fine as expected.
But when I try to do this in
or even in
it is always
. I also tryed do this in
onCreateOptionsMenu(Menu menu)
after inflating my menu from resource, but without any succes.

Therefore I can't understand when actionbar items created and how to catch this moment?

Answer Source

As it has been said here and here, getActionView returns the view that we sets in setActionView. Therefore, the only one way to customize action bar menu item described here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download