I have a method where the custom Toolbar is initialized to which I attached the Menu. I need to change icons for menu items from another method. How to access them?
public void initToolbar() { toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.refresh: return true; case R.id.back: return true; } return false; } }); toolbar.inflateMenu(R.menu.menu_toolbar); }