title: Fragment page invalids findViewByID
body: <p>I am very new to java so pardon any mistakes here. I'm trying to create an intent for one of my buttons which is in a fragment page. However, the layout of a fragment file is different from a regular java class file. My <code>findViewByID</code> button is invalid and I can't continue with my intent.</p>
  
  <p>I guess that the issue has to do with either my constructor or the position of my code. I'm aware that similar questions have been asked. However, I neither  understand those solution nor the background of the question.</p>
  
  <pre class="lang-java prettyprint-override"><code>public class HomeFragment extends Fragment {
  
      private Button trending_button;
  
      public HomeFragment() {
          // Required empty public constructor
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.fragment_home, container, false);
  
          trending_button = findViewByID(R.id.trending_button);
      }
  }
  </code></pre>