I am have an ActionBar with some menu items that are icons. And what I want is to toggle between two drawables.
This is what I have done so far:
if(id == R.id.shift_day){
if(DoN==0){
item.setIcon(R.drawable.ic_menu_weather_day);
shift="shift night";
DoN=1;
onStart();
}
if(DoN==1){
item.setIcon(R.drawable.ic_menu_weather_night);
shift="shift day";
DoN=0;
onStart();
}
}
This does not work so good because it changes the icon once and never back again.