title: Using getView().findViewById in fragment returns NullPointerException
body: <p>It does give me warning but I've never used fragments so I'm not sure how to fix it. I get the error on the third line of the code where I'm trying to find the toolbar.</p>
  
  <pre><code>    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          view = (View) inflater.inflate(R.layout.fragment_contact, container, false);
  
          Toolbar toolbar = getView().findViewById(R.id.toolbar);
          ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
          ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayShowTitleEnabled(false);
  
          TextView textView = getView().findViewById(R.id.vive_unadeca);
          textView.setOnClickListener(new View.OnClickListener() {//do stuff here} });
  
          LinearLayout mapsT = getView().findViewById(R.id.locationT);
          ImageView mapsI = getView().findViewById(R.id.location);
  
          mapsT.setOnClickListener(new View.OnClickListener() {//do stuff here} });
  
          mapsI.setOnClickListener(new View.OnClickListener() {//do stuff here} });
  
          LinearLayout phoneT = getView().findViewById(R.id.phone_num);
          ImageView phoneI = getView().findViewById(R.id.phone_icon);
  
          phoneT.setOnClickListener(new View.OnClickListener() {//do stuff here} });
  
          phoneI.setOnClickListener(new View.OnClickListener() {//do stuff here} });
  
          LinearLayout emailT = getView().findViewById(R.id.email);
          ImageView emailI = getView().findViewById(R.id.email_icon);
  
          emailT.setOnClickListener(new View.OnClickListener() {//do stuff here} });
  
          emailI.setOnClickListener(new View.OnClickListener() {//do stuff here} });
  
          LinearLayout whatsappT = getView().findViewById(R.id.whatsapp_num);
          ImageView whatsappI = getView().findViewById(R.id.whatsapp_icon);
  
          whatsappT.setOnClickListener(new View.OnClickListener() {//do stuff here} });
  
          whatsappI.setOnClickListener(new View.OnClickListener(){//do stuff here} });
  
          return view;
      }
  </code></pre>
  
  <p>In the clickListeners I call other methods that are underneath the onCreateView which just call the intents like open gmail, open whatsapp, open phone call, google maps and facebook.</p>
  
  <p>What am I doing wrong?</p>