I have a navigation drawer in which I dynamically add categories. each category has an id that comes from the server. I need to pull category titles when I click on it. pull out, then I pull out, but it displays a completely different title with a completely different id.
public boolean onNavigationItemSelected(MenuItem item) { int id = item.getItemId(); ... else { title = String.valueOf(navigationView.getMenu().getItem(id).getTitle()); NewsFrag fragment = NewsFrag.newInstance(id, null, title); if (fragment != null) { FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.content_frame, fragment) .commit(); That is, I click on one and categories. her idi from the server is 5, her "Apple" title. But in the end I get on the next step Idi 6 and the title "Orange". Where can this go? What did I miss? Approximately, there is an idea that this is due to the fact that I get some kind of aidi, but it already works with the aidi element as it is located in the system itself. But I do not know how to get around this. Thank you in advance.