title: Skip over screens
body: <p>So I am working on a project for my programming class that requires us to create a login screen, a screen where the user inputs their birthday and some other information, and a blank screen (more will be done later but for the moment it's just a blank screen). When I start up my app and correctly put in the login information it skips over the second screen and goes straight to the blank one, I am unsure of why it does this. This is the code for the login screen MainActivity:</p>
  
  <pre><code>public enum LoginSuccess {
      login(1),
      password(2),
      success(0);
  
      private int intValue;
  
      LoginSuccess(int value){
          intValue = value;
      }
  
      public int getIntValue(){
          return intValue;
      }
  
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      final TextView txtLogin = (TextView) findViewById(R.id.idLoginText);
      final TextView txtPassword = (TextView) findViewById(R.id.idPassword);
      Button btnLogin = (Button) findViewById(R.id.btnLogin);
  
  
      btnLogin.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Toast toastError = null;
  
              switch(CheckLogin(txtLogin.getText().toString(), txtPassword.getText().toString())){
                  case login:
                      toastError.makeText(getApplicationContext(), getString(R.string.errMessageLogin), toastError.LENGTH_LONG).show();
                      txtLogin.requestFocus();
                      break;
                  case password:
                      toastError.makeText(getApplicationContext(), getString(R.string.errMessagePassword), toastError.LENGTH_LONG).show();
                      txtPassword.requestFocus();
                      break;
                  default:
                      startActivity(new Intent(MainActivity.this, MainClassList.class));
  
  
              }
          }
      });
  }
  
  
  LoginSuccess CheckLogin(String txtLogin, String txtPassword){
      String holdLogin = "Codie";
      String holdPassword = "password";
  
      if (!holdLogin.equals(txtLogin)){
          return LoginSuccess.login;
      }
  
      if (!holdPassword.equals(txtPassword)){
          return LoginSuccess.password;
      }
  
      return LoginSuccess.success;
  
  }
  }
  </code></pre>
  
  <p>This is the code for the second screen MainClassList:</p>
  
  <pre><code>@Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main_class_list);
         final Switch swDegreeCert = (Switch) findViewById(R.id.swDegreeCert);
         final Spinner spnDegree = (Spinner) findViewById(R.id.spnDegree);
         final Spinner spnCertificate = (Spinner) findViewById(R.id.spnCertificate);
         final TextView txtCertificate = (TextView) findViewById(R.id.lblCertificate);
         final TextView txtDegree = (TextView) findViewById(R.id.lblDegree);
         final Button btnNext = (Button) findViewById(R.id.btnNext);
  
      final EditText firstName = (EditText) findViewById(R.id.txtFirstName);
      final EditText lastName = (EditText) findViewById(R.id.txtLastName);
      final EditText phone = (EditText) findViewById(R.id.txtPhone);
  
      final Spinner spMonth = (Spinner) findViewById(R.id.spnMonth);
      final EditText txtDay = (EditText) findViewById(R.id.txtDay);
      final EditText txtYear = (EditText) findViewById(R.id.txtYear);
  
      firstName.requestFocus();
  
      swDegreeCert.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              if (isChecked){
                  spnDegree.setVisibility(View.VISIBLE);
                  txtDegree.setVisibility(View.VISIBLE);
                  spnCertificate.setVisibility(View.GONE);
                  txtCertificate.setVisibility(View.GONE);
              } else {
                  spnDegree.setVisibility(View.GONE);
                  txtDegree.setVisibility(View.GONE);
                  spnCertificate.setVisibility(View.VISIBLE);
                  txtCertificate.setVisibility(View.VISIBLE);
              }
          }
      });
  
      btnNext.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              if (checkData()){
                  String doBirth = "";
                  doBirth = spMonth.getSelectedItem().toString() + "/" + txtDay.getText().toString() + "/" + txtYear.getText().toString();
  
                  // old way
                  // startActivity(new Intent(MainClassList.this, ChooseClass.class);
  
                  //new way
                  Intent nextScreen = new Intent(MainClassList.this, ChooseClass.class);
                  nextScreen.putExtra("FirstName", firstName.getText().toString());
                  nextScreen.putExtra("LastName", lastName.getText().toString());
                  nextScreen.putExtra("Phone", phone.getText().toString());
                  nextScreen.putExtra("BirthDate", doBirth);
  
                  if (spnDegree.getVisibility() == View.VISIBLE){
                      nextScreen.putExtra("isDegreeCert", "Degree");
                      nextScreen.putExtra("degreeCert", spnDegree.getSelectedItem().toString());
  
                  } else {
                      nextScreen.putExtra("isDegreeCert", "Certificate");
                      nextScreen.putExtra("degreeCert", spnCertificate.getSelectedItem().toString());
                  }
                  //Start Activity
                  startActivity(nextScreen);
  
              }
          }
      });
  }
  
  
  
  private boolean checkData(){
      final EditText firstName = (EditText) findViewById(R.id.txtFirstName);
      final EditText lastName = (EditText) findViewById(R.id.txtLastName);
      final EditText phone = (EditText) findViewById(R.id.txtPhone);
      final EditText txtDay = (EditText) findViewById(R.id.txtDay);
      final EditText txtYear = (EditText) findViewById(R.id.txtYear);
  
  
      if(firstName.getText().toString().isEmpty()){
          //error
          firstName.setError("Invalid First Name");
          firstName.requestFocus();
          return false;
      }
  
      if(lastName.getText().toString().isEmpty()){
          lastName.setError("Invalid Last Name");
          lastName.requestFocus();
          return false;
      }
  
      if(phone.getText().toString().isEmpty()) {
          phone.setError("Invalid Phone Number");
          phone.requestFocus();
          return false;
      }
  
      if(txtDay.getText().toString().isEmpty()) {
          txtDay.setError("Invalid Date Selection");
          txtDay.requestFocus();
          return false;
      }
  
      if(txtYear.getText().toString().isEmpty()) {
          txtYear.setError("Invalid Date Selection");
          txtYear.requestFocus();
          return false;
      }
  
      return true;
  
  
  }
  }
  </code></pre>
  
  <p>The third class ChooseClass does not have any significant code. To reiterate, the app goes from MainActivity straight to ChooseClass and I have no idea why. Any and all help is greatly appreciated.</p>
  
  <p>Here is my manifest:</p>
  
  <pre><code>&lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity android:name=".MainClassList" /&gt;
      &lt;activity android:name=".ChooseClass"&gt;&lt;/activity&gt;
  &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>