title: Start new Activity from spinner
body: <p>I am trying to start a new activity when I select an option from my spinner but whenever I select the option that starts a new activity the app crashes. I am starting the new activity with an intent and I am using onItemSelected for the spinner</p>
  
  <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.view.Window;
  import android.view.WindowManager;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemSelectedListener;
  import android.widget.Spinner;
  import android.widget.TextView;
  
  public class Abs extends Activity {
  
  private Spinner StretchType;
  TextView tv;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(
              WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
              WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
      setContentView(R.layout.abs);
      addListenerOnSpinnerItemSelection();
      tv = (TextView) findViewById(R.id.tvTypeofStretch);
  
  }
  
  public void addListenerOnSpinnerItemSelection() {
      StretchType = (Spinner) findViewById(R.id.sSType);
      StretchType
              .setOnItemSelectedListener(new CustomOnItemSelectedListener());
  }
  
  public class CustomOnItemSelectedListener extends Activity implements
          OnItemSelectedListener {
  
      public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos,
              long id) {
   // **************************** below here is where I start the new activity
          switch (pos) {
          case (1):
              Intent i = new Intent(this, Practice.class);
              startActivity(i);
              break;
          }
          // **************************** above here is where I start the new activity
      }
  
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
          // TODO Auto-generated method stub
  
      }
  }
  
  }
  </code></pre>