title: Setting defaults when .getIntent().getExtras() is null
body: <p>I'm attempting to pull user input from a couple <code>EditText</code> fields into another activity. In particular, I'd like to utilize team names input by the user in another activity of the app.</p>
  
  <p>So, taking input from here:</p>
  
  <p><img src="https://i.stack.imgur.com/PxGoZ.png" alt="enter image description here"></p>
  
  <p>and using it here:</p>
  
  <p><img src="https://i.stack.imgur.com/H9Zry.png" alt="enter image description here"></p>
  
  <p>As seen in the photo above, I've been successful in implementing this when the user enters in a couple team names, which I'm handling with <code>getIntent().getExtras()</code>.</p>
  
  <p>However, if the user clicks the "Start Scorekeeper" button without entering in any team names, I get the following:</p>
  
  <p><img src="https://i.stack.imgur.com/uYOXp.png" alt="enter image description here"></p>
  
  <p>However, I'd like to set default team names of "Team A" and "Team B".</p>
  
  <p>I've tried to accomplish this with the following (which hasn't worked):</p>
  
  <p><strong>TeamSelector.java</strong>:</p>
  
  <pre><code>public void onClick(View view) {
      Intent i = new Intent(this, ScoreKeeper.class);
  
      final EditText teamAInput = (EditText) findViewById(R.id.team_a_input);
      String teamAName = teamAInput.getText().toString();
      i.putExtra("teamA", teamAName);
  
      final EditText teamBInput = (EditText) findViewById(R.id.team_b_input);
      String teamBName = teamBInput.getText().toString();
      i.putExtra("teamB", teamBName);
  
      startActivity(i);
  }
  </code></pre>
  
  <p>Then creating a conditional as I pick up the intent.</p>
  
  <p><strong>ScoreKeeper.java:</strong></p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_score_keeper);
  
      Bundle teamNames = getIntent().getExtras();
      if(teamNames==null){
          final TextView teamAText = (TextView) findViewById(R.id.teamAText);
          teamAText.setText(getString(R.string.team_a_name));
  
          final TextView teamBText = (TextView) findViewById(R.id.teamBText);
          teamBText.setText(getString(R.string.team_b_name));
      }
      else {
          String teamA = teamNames.getString("teamA");
          final TextView teamAText = (TextView) findViewById(R.id.teamAText);
          teamAText.setText(teamA);
  
          String teamB = teamNames.getString("teamB");
          final TextView teamBText = (TextView) findViewById(R.id.teamBText);
          teamBText.setText(teamB);
      }
  }
  </code></pre>
  
  <p>I've also tried coding default strings in the XML, which hasn't been effective (only one team included for brevity):</p>
  
  <pre><code>&lt;TextView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:fontFamily="sans-serif-medium"
      android:gravity="center"
      android:padding="16dp"
      android:text="@string/team_a_name"
      android:id="@+id/teamAText"
      android:textColor="@android:color/black"
              android:textSize="14sp" /&gt;
  </code></pre>
  
  <p>Is there a way to effectively set a default when <code>.getIntent().getExtras()</code> is null?</p>