title: Fault in Intent, app shuts down automatically
body: <p>Recently I entered the world of app development. I get stuck with the first intent unfortunately. I try to send the information from the numberpicker (in the main activity) to the page where the user can define the names of the players (addPlayersActivity). When simulating the app, it shuts down after clicking the button on the Main Activity. When deleting the code on the receiving side of the intent, the addPlayersActivity opens without any problems. The aim is to put the intent, the number of players, into an integer. To test this I created a TextField in receiving Activity that should show the value of the integer.</p>
  
  <pre><code>    public class MainActivity extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      //Get the widgets reference from XML layout
      final TextView numberofplayers = (TextView) findViewById(R.id.selectNumberPlayers);
      NumberPicker np = (NumberPicker) findViewById(R.id.np);
  
      //Populate NumberPicker values from minimum and maximum value range
      //Set the minimum value of NumberPicker
      np.setMinValue(2);
      //Specify the maximum value/number of NumberPicker
      np.setMaxValue(8);
  
      //Gets whether the selector wheel wraps when reaching the min/max value.
      np.setWrapSelectorWheel(true);
  
      //Set a value change listener for NumberPicker
      np.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
          @Override
          public void onValueChange(NumberPicker picker, int oldVal, int newVal){
              //Display the newly selected number from picker
              numberofplayers.setText("# of Players: " + newVal);
          }
      });
  
  }
  
  public void onClick(View view){
      Intent getPlayerNamesIntent = new Intent(this, AddPlayersActivity.class);
  
      NumberPicker np = (NumberPicker)findViewById(R.id.np);
      Integer numberOfPlayers = np.getValue();
      getPlayerNamesIntent.putExtra("NUM_PLAYERS", numberOfPlayers);
  
      startActivity(getPlayerNamesIntent);
  }
  }
  </code></pre>
  
  <p>The code at the addPlayersActivity</p>
  
  <pre><code>    import android.content.Intent;
      import android.os.Bundle;
      import android.support.v7.app.AppCompatActivity;
      import android.view.View;
      import android.widget.TextView;
  
      public class AddPlayersActivity extends AppCompatActivity {
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_add_players);
  
      int numberOfPlayers = getIntent().getExtras().getInt("NUM_PLAYERS");
  
      TextView chosenPlayers = (TextView)findViewById(R.id.chosenPlayers);
      chosenPlayers.setText(numberOfPlayers);
  
  }
  
  public void onClick(View view){
      Intent intent1 = new Intent(this, ChallengesActivity.class);
      startActivity(intent1);
  }
  }
  </code></pre>
  
  <p>I would like to apologize in advance if this question is to vague, I just started out and I will improve myself over time.</p>
  
  <p>Ivo</p>
  
  <p><strong>EDIT</strong>
  Found what was wrong: an integer value cannot be the input for the setText().
  <a href="https://stackoverflow.com/questions/8327235/how-to-set-text-an-integer-and-get-int-without-getting-error">how to set text an integer and get int without getting error</a></p>