I would like to dynamically change the \"home\" icon in the ActionBar. This is easily done in v14 with ActionBar.setIcon(...), but I can\'t find anyway to accomplish this i
If your actionbar works like Sherlock and is based on menu items, this is my solution:
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem switchButton = menu.findItem(R.id.SwitchSearchOption);
if(searchScriptDisplayed){
switchButton.setIcon(R.drawable.menu_precedent);
}else{
switchButton.setIcon(R.drawable.icon_search);
}
return super.onPrepareOptionsMenu(menu);
}