title: How I can open a new Activity from a Fragment?
body: <p>I'm experiencing some kind of troubleshooting and I tried look for similar answers here but did not find any.</p>
  
  <pre><code>public class TicketFragment extends Fragment {
  
      public Button strandard;
      public Button premium;
      public Button vip;
  
  
      @Nullable
      @Override
      public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          return inflater.inflate(R.layout.fragment_ticket, container, false);
  
      }
  
      public void openMainPage(){
          strandard = (Button)getView().findViewById(R.id.strandard);
          strandard.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  Intent intent = new Intent(getActivity(), Payment.class);
                  startActivity(intent);
  
              }
          });
      }
  
  }
  </code></pre>
  
  <p>How I can call this method? Since this is a fragment, if I simply put it on the <code>onCreateView</code> method, it says that the statement is unreachable (if I put it before the return method it gives me an error when I lunch the project). </p>