-1

I have method t change the menu of navigation drawer, I remove the line at XML file activity_main.xml

 <android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    />

so I can add the menu resource from code

    navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.inflateMenu(R.menu.activity_main_drawer);
    navigationView.setNavigationItemSelectedListener(this);

But when I need to replace the menu by another resource the menu will be appended to the first one, but I need to remove the oldest plz help me

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

0

Thanks for #Mohsen navigationView.getMenu().clear() it will do it