title: Dynamic Menus in NavigationView
body: <p>I have this Layout:</p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;!-- The ActionBar --&gt;
      &lt;include
          layout="@layout/toolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" /&gt;
  
      &lt;!-- The main content view --&gt;
      &lt;FrameLayout
          android:id="@+id/flContent"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;!-- The navigation drawer --&gt;
  &lt;android.support.design.widget.NavigationView
      android:id="@+id/nvView"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:background="@android:color/white"
      app:menu="@menu/drawer_menu"
      app:headerLayout="@layout/nav_header"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>So, looking that in <code>NavigationView</code> we have the attribute: </p>
  
  <pre><code>  app:menu="@menu/drawer_menu"
  </code></pre>
  
  <p>And I have this XML id menu folder.</p>
  
  <p>I wanna make dynamic menus, ie, in code I should mount the 'MenuItem' objects and set into <code>NavigationView</code>.</p>
  
  <p>Is this correct?
  Is this best pratice?
  Is this possible?</p>
  
  <p>Note: My code is working with 'static drawer_menu', I want to improve it.</p>
  
  <p>I'm waiting.</p>
  
  <p><strong>[EDIT]</strong></p>
  
  <p>I make it:</p>
  
  <pre><code> Menu menu = nvDrawer.getMenu();
          for (KSMenuItem kmi : menus.values()) {
              if (menu.size() == 0) {
                  menu.add(kmi.getId());
              }
              if (menu.getItem(kmi.getId()) == null) {
                  menu.add(kmi.getId());
              }
              MenuItem mi = menu.getItem(kmi.getId());
              mi.setIcon(kmi.getIcon());
              mi.setTitle(kmi.getTittle());
          }
  </code></pre>
  
  <p>But this error happened:</p>
  
  <blockquote>
    <p>06-27 15:26:15.538  15335-15335/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.example.sticdev30.newdrawer, PID: 15335
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sticdev30.newdrawer/com.example.sticdev30.newdrawer.MainActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x1</p>
  </blockquote>
  
  <p>KSMenuItem is a POJO with my menu data. In kmi.id I informed incremental integers...</p>
  
  <p>I'm waitning</p>