title: How do i create a custom start activity method in android?
body: <p>I want to create a method to start multiple activities. I have set <code>setOnClickListener</code> on every button. I have implemented <code>onClick()</code> method that looks like this:</p>
  
  <pre><code>public void onClick(View view) {
      switch (view.getId()) {
          case R.id.firstActivityButton:
              Intent i1 = new Intent(getApplicationContext(), FirstActivity.class);
              startActivity(i1);
              break;
  
          case R.id.secondActivityButton:
              Intent i2 = new Intent(getApplicationContext(), SecondActivity.class);
              startActivity(i2);
              break;
  
          //and so on
      }
  }
  </code></pre>
  
  <p>I want to use a method in every <code>case</code> like this: <code>startSpecificActivity(FirstActivity.class)</code> This is my method:</p>
  
  <pre><code>public void startSpecificActivity(Context context) {
      Intent intent = new Intent(getApplicationContext(), context.class);
      startActivity(intent);
  }
  </code></pre>