I have fragment in my app that acts as a portal to link to other fragments. The way I implemented this is by simulating a click on the nav drawer, which already handles all the code for switching fragments.
NavigationDrawerAdapter.ViewHolder v = (NavigationDrawerAdapter.ViewHolder) mDrawerList.findViewHolderForAdapterPosition(i);
v.itemView.performClick();
However, I get an error when I try to simulate a click on an item that isn't visible on the RecyclerView's current state. I know this is because RecyclerView only keeps visible views in its array of ViewHolders, but I need the ability to simulate a click on views that aren't in that array.
Yes, I know, I should just refactor my code so that I'm not doing janky things like simulating user clicks on the nav drawer. However, in the interest of time, and an understanding that this nav drawer will never really get incredibly big, as long as there are no other really negative caveats other than memory issues, I think it's the best working solution for the current state of my code.