-1
@Override
public boolean onOptionsItemSelected(MenuItem item) {


    switch (item.getItemId()) {
        case android.R.id.home:
            //action
            break;
    }

    return super.onOptionsItemSelected(item);
}

How can I change the Icon from the Back Button (android.R.id.home) in OptionsMenu?

Thank you!

Seilbahn
  • 13
  • 3
  • Possible duplicate of [How to change option menu icon in the action bar?](https://stackoverflow.com/questions/26300480/how-to-change-option-menu-icon-in-the-action-bar) – Vodet Mar 12 '18 at 16:21

1 Answers1

0
switch (item.getItemId()) {
    case android.R.id.home:
        menu.getItem(0).setIcon(getResources().getDrawable(R.drawable.icon_converted));
        break;
}

Here menu.getItem(0) will the first menu, it should behave accordingly.

ADM
  • 20,406
  • 11
  • 52
  • 83
Hardik Vegad
  • 111
  • 1
  • 7