title: Button won't open new activity
body: <p>So im trying to make my buttons open new activities within my navigation drawer fragments but something broke in my MainActivity.java</p>
  
  <p>my MainActivity.java....</p>
  
  <pre><code>   package east.myapplication;
  
  
     import android.support.design.widget.NavigationView;
     import android.support.v4.widget.DrawerLayout;
     import android.support.v7.app.ActionBarDrawerToggle;
     import android.support.v7.app.AppCompatActivity;
     import android.os.Bundle;
     import android.support.v7.widget.Toolbar;
     import android.view.MenuItem;
  
     public class MainActivity extends AppCompatActivity {
     DrawerLayout drawerLayout;
     Toolbar toolbar;
     ActionBarDrawerToggle actionBarDrawerToggle;
     android.support.v4.app.FragmentTransaction fragmentTransaction;
     NavigationView navigationView;
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
  
      actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout,    toolbar, R.string.drawer_open,
              R.string.drawer_close);
  
      drawerLayout.setDrawerListener((actionBarDrawerToggle));
  
      fragmentTransaction = getSupportFragmentManager().beginTransaction();
      fragmentTransaction.add(R.id.main_container,new HomeFragment());
      fragmentTransaction.commit();
      getSupportActionBar().setTitle("Home Fragment...");
      navigationView = (NavigationView)findViewById(R.id.navigation_view);
      navigationView.setNavigationItemSelectedListener(new     NavigationView.OnNavigationItemSelectedListener() {
          @Override
          public boolean onNavigationItemSelected(MenuItem item) {
              switch (item.getItemId())
              {
                  case R.id.home_id:
                      fragmentTransaction =   getSupportFragmentManager().beginTransaction();
                      fragmentTransaction.replace(R.id.main_container, new   HomeFragment());
                      fragmentTransaction.commit();
                      getSupportActionBar().setTitle("Home Fragment");
                      item.setChecked(true);
                      drawerLayout.closeDrawers();
                      break;
  
                  case R.id.id_rewards:
                      fragmentTransaction =   getSupportFragmentManager().beginTransaction();
                      fragmentTransaction.replace(R.id.main_container, new  RewardsFragment());
                      fragmentTransaction.commit();
                      getSupportActionBar().setTitle("Rewards");
                      item.setChecked(true);
                      drawerLayout.closeDrawers();
                      break;
  
                  case R.id.id_settings:
                      fragmentTransaction =   getSupportFragmentManager().beginTransaction();
                      fragmentTransaction.replace(R.id.main_container, new   SettingsFragment());
                      fragmentTransaction.commit();
                      getSupportActionBar().setTitle("Settings Fragment");
                      item.setChecked(true);
                      drawerLayout.closeDrawers();
                      break;
              }
  
  
  
              return true;
          }
      });
  
  }
  
  
      @Override
      protected void onPostCreate (Bundle savedInstanceState) {
      super.onPostCreate(savedInstanceState);
      actionBarDrawerToggle.syncState();
  }
  
  }
  </code></pre>
  
  <p>and my rewardsfragment...</p>
  
  <pre><code>    package east.myapplication;
  
      import android.app.Activity;
      import android.content.Intent;
      import android.os.Bundle;
      import android.view.View;
      import android.widget.Button;
  
  
      public class RewardsFragment extends Activity {
  
      Button button;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.fragment_rewards);
      Button button = (Button) findViewById(R.id.button);
      Button anotherButton = (Button) findViewById(R.id.button2);
      Button anotherButton2 = (Button) findViewById(R.id.button3);
      Button anotherButton3 = (Button) findViewById(R.id.button4);
      Button anotherButton4 = (Button) findViewById(R.id.button5);
      Button anotherButton5 = (Button) findViewById(R.id.button6);
      button.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              Intent intent = new Intent(RewardsFragment.this, AmazonActivity.class);
              RewardsFragment.this.startActivity(intent);
          }
      });
  
       /* new button to open a new activity */
      anotherButton.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this, CVSActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  
       /* new button to open a new activity */
      anotherButton2.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this, SephoraActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  
       /* new button to open a new activity */
      anotherButton3.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this,    PlayStationActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  
       /* new button to open a new activity */
      anotherButton4.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this,    AMCActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  
       /* new button to open a new activity */
      anotherButton5.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this,             BKActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The problem is <code>fragmentTransaction.replace(R.id.main_container, new RewardsFragment());</code> it has a red underline under <code>RewardsFragment</code> and i dont know how to fix it</p>
  
  <p>I tried everything and this is what I have so far..</p>
  
  <pre><code>    package east.myapplication;
  
      import android.app.Activity;
      import android.content.Intent;
      import android.os.Bundle;
      import android.support.v4.app.FragmentTransaction;
      import android.view.View;
      import android.widget.Button;
      import android.support.v4.app.Fragment;
  
  
      public class RewardsFragment extends Fragment {
  
      Button button;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.fragment_rewards);
      Button button = (Button) findViewById(R.id.button);
      Button anotherButton = (Button) findViewById(R.id.button2);
      Button anotherButton2 = (Button) findViewById(R.id.button3);
      Button anotherButton3 = (Button) findViewById(R.id.button4);
      Button anotherButton4 = (Button) findViewById(R.id.button5);
      Button anotherButton5 = (Button) findViewById(R.id.button6);
      button.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              Intent intent = new Intent(RewardsFragment.this, AmazonActivity.class);
              RewardsFragment.this.startActivity(intent);
          }
      });
  
   /* new button to open a new activity */
      anotherButton.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this, CVSActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  
   /* new button to open a new activity */
      anotherButton2.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this, SephoraActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  
   /* new button to open a new activity */
      anotherButton3.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this,    PlayStationActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  
   /* new button to open a new activity */
      anotherButton4.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this,    AMCActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });
  
   /* new button to open a new activity */
      anotherButton5.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              // creating the intent
              Intent intent = new Intent(RewardsFragment.this,    BKActivity.class);
              // starting activity with the created intent
              startActivity(intent);
          }
      });}
  </code></pre>
  
  <p>}</p>
  
  <p>My setContentView is bright red, my findViewByID is red, and lastly (RewardsFragment.this, AmazonActivity.class); is red along with all my other .class's</p>
  
  <p>Here is my bugs</p>
  
  <p>Error:(25, 9) error: cannot find symbol method setContentView(int)</p>
  
  <p>Error:(26, 34) error: cannot find symbol method findViewById(int)</p>
  
  <p>Error:(27, 41) error: cannot find symbol method findViewById(int)</p>
  
  <p>Error:(28, 42) error: cannot find symbol method findViewById(int)</p>
  
  <p>Error:(29, 42) error: cannot find symbol method findViewById(int)</p>
  
  <p>Error:(30, 42) error: cannot find symbol method findViewById(int)</p>
  
  <p>Error:(31, 42) error: cannot find symbol method findViewById(int)</p>
  
  <p>Error:(34, 33) error: no suitable constructor found for Intent(RewardsFragment,Class)
  constructor Intent.Intent(String,Uri) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to String)
  constructor Intent.Intent(Context,Class) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to Context)</p>
  
  <p>Error:(43, 33) error: no suitable constructor found for Intent(RewardsFragment,Class)
  constructor Intent.Intent(String,Uri) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to String)
  constructor Intent.Intent(Context,Class) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to Context)</p>
  
  <p>Error:(53, 33) error: no suitable constructor found for Intent(RewardsFragment,Class)
  constructor Intent.Intent(String,Uri) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to String)
  constructor Intent.Intent(Context,Class) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to Context)</p>
  
  <p>Error:(63, 33) error: no suitable constructor found for Intent(RewardsFragment,Class)
  constructor Intent.Intent(String,Uri) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to String)
  constructor Intent.Intent(Context,Class) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to Context)</p>
  
  <p>Error:(73, 33) error: no suitable constructor found for Intent(RewardsFragment,Class)
  constructor Intent.Intent(String,Uri) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to String)
  constructor Intent.Intent(Context,Class) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to Context)</p>
  
  <p>Error:(83, 33) error: no suitable constructor found for Intent(RewardsFragment,Class)
  constructor Intent.Intent(String,Uri) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to String)
  constructor Intent.Intent(Context,Class) is not applicable
  (argument mismatch; RewardsFragment cannot be converted to Context)</p>
  
  <p>Error:Execution failed for task ':app:compileDebugJavaWithJavac'.</p>
  
  <blockquote>
    <p>Compilation failed; see the compiler error output for details.</p>
  </blockquote>