title: how to launch an activity from a fragment of a navigation drawer
body: <p>I built a navigation drawer. When the app launches, I direct the user directly to "MainMenuActivity" activity from the MainActivity. 
  Inside the "MainMenuActivity", there is a button that should direct the user to another activity which is "Order List"; I applied two code parts but non is working:</p>
  
  <p>The first code:</p>
  
  <pre><code>public class MainMenuActivity extends Fragment {
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.activity_mainmenu, container, false);
  
      Button Orderlistbtn = (Button) rootView.findViewById(R.id.orderlistbtn);
      Orderlistbtn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent = new Intent(MainMenuActivity.this, OrderList.class);
              startActivity(intent);
          }
      });
  
      return rootView;
  }
  }
  </code></pre>
  
  <p>the app doesn't run, the first code gives me the following error in the logcat:</p>
  
  <pre><code>  Error:(41, 33) error: no suitable constructor found for Intent(MainMenuActivity,Class&lt;OrderList&gt;)
     constructor Intent.Intent(String,Uri) is not applicable
    (argument mismatch; MainMenuActivity cannot be converted to String)
     constructor Intent.Intent(Context,Class&lt;?&gt;) is not applicable
    (argument mismatch; MainMenuActivity cannot be converted to Context)
  </code></pre>
  
  <p>The second code:</p>
  
  <pre><code>public class MainMenuActivity extends Fragment {
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.activity_mainmenu, container, false);
  
      Button Orderlistbtn = (Button) rootView.findViewById(R.id.orderlistbtn);
      Orderlistbtn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent = new Intent(getActivity(), OrderList.class);
              startActivity(intent);
          }
      });
  
      return rootView;
  }
  }
  </code></pre>
  
  <p>but the app crashes once it launches with the following logcat error</p>
  
  <pre><code> java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{package/package.MainMenuActivity}: java.lang.ClassCastException: package.MainMenuActivity cannot be cast to android.app.Activity
  </code></pre>
  
  <p>this is "activity_mainmenu.xml" file:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:paddingBottom="@dimen/activity_vertical_margin"
  tools:context=".MainActivity"
  android:background="@android:color/background_light"&gt;
  
  
  &lt;Button
      android:background="#ffff8800"
      android:textColor="@android:color/white"
  
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="          My order list        "
      android:id="@+id/orderlistbtn"
  
      android:layout_alignParentBottom="true"
      android:layout_alignParentEnd="true"
       /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>