title: Null Object error when trying to set up navigation view listener
body: <p>I am trying to setup a click listener in my menu which inside of a navigation view inside a fragment- I want to set the listener inside of my fragment as well</p>
  
  <p>I am getting the error </p>
  
  <pre><code>"Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void
  android.support.design.widget.NavigationView.setNavigationItemSelectedListener(android.support.design.widget.NavigationView$OnNavigationItemSelectedListener)' on a null object reference"
  </code></pre>
  
  <p>When I try to run this code</p>
  
  <pre><code>public class FragmentNavigationDrawer extends Fragment implements NavigationView.OnNavigationItemSelectedListener {
  
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      NavigationView navigationView = (NavigationView) getActivity().findViewById(R.id.nav_view);
      navigationView.setNavigationItemSelectedListener(this);
      return inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
  }
  </code></pre>
  
  <p>Anyone know how to solve this issue? thanks</p>