title: How do i get a button to open a new activity in android studio?
body: <p>I'd seen this asked in many, many places and have tried to follow the instructions given to no avail. I dont know if the questions are old, i'm doing things incorrectly or if my android studio program isnt working. What i want to do is to <strong>only</strong> open a new activity when a button is clicked. I'm very new to developing android applications.</p>
  
  <p>I've recently tried to follow the answer provided here: <a href="https://stackoverflow.com/questions/24610527/how-do-i-get-a-button-to-open-another-activity-in-android-studio">How do I get a button to open another activity in Android Studio?</a></p>
  
  <p>OnClick on the button is called "goTutorials"
  My original activity is called home (Not mainActivity)
  The new one is called tutorials.</p>
  
  <p>This is what i added from trying to follow the link above:
  In home's java file:</p>
  
  <pre><code>btn = (Button)findViewById(R.id.open_activity_button);
  
  btn.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
          startActivity(new Intent(home.this, tutorials.class));
      }
  });
  </code></pre>
  
  <p>In manifest file:</p>
  
  <pre><code>&lt;activity
      android:name="tutorials"
      android:label="@string/app_name"&gt;
  &lt;/activity&gt;
  </code></pre>