Skip to content

Instantly share code, notes, and snippets.

@prdpspkt
Created October 29, 2018 04:39
Show Gist options
  • Save prdpspkt/d47d248ed0f9f59a42c5c1cb51ec800a to your computer and use it in GitHub Desktop.
Save prdpspkt/d47d248ed0f9f59a42c5c1cb51ec800a to your computer and use it in GitHub Desktop.
Dynamically adding items and setting icons in Navigation Drawer Menu
final Menu menu = navigationView.getMenu();
for (int i = 0; i < types.size(); i++) {
MenuItem item = menu.add(R.id.notice_types, types.get(i).type_id, 0, types.get(i).name);
item.setIcon(R.drawable.asterisk);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment