I have written this code to add arrows to the right of my menu items in navigation drawer. I have repeated the same code seperately for each index.
navigationView.getMenu().getItem(0).setActionView(R.layout.arrow_image);
navigationView.getMenu().getItem(1).setActionView(R.layout.arrow_image);
navigationView.getMenu().getItem(2).setActionView(R.layout.arrow_image);
Is there any way in which I can specify all the index numbers (Here 0,1 and 2) where the arrow should be present in just one line?
Haven't tested, try this:
for(int i=0; i < navigationView.getMenu().size(); i++){
navigationView.getMenu().getItem(i).setActionView(R.layout.arrow_image);
}