I'm currently implementing theme support for my application and a part of it is changing the action bar app icon. I want to use a dark icon when Holo Light is selected. Everything is done in the method except for the part where the action bar app icon is set. The code that im trying to use is:
getActionBar();
ActionBar.setIcon(R.drawable.my_icon);
"There is no such reference avavible here" is the error that i'm getting. How should this be done correctly?
BTW my minSdkVersion is 14 so no action bar sherlock stuff.
Though its a bit late answer but i thought it might be useful.
From inside an activity: For API level 14 or higher:
For lower API level we have to extend ActionBarActivity and then:
From inside a Fragment: For API level 14 or higher:
For lower API level we can use (activity must extend ActionBarActivity):
And in both cases we have to call setDisplayShowHomeEnabled(true) before setting the icon or logo.