title: Using intent and bundle for integers in Android
body: <p>Say I wanted to pass data from one activity/class to the other involving an integer data type. Here's what I have for the MainActivity (first) class so far:</p>
  
  <pre><code>@Override
  public void onClick(View v) {
      Intent i = new Intent(this, SecondActivity.class);
      final int x = 3;
      i.putExtra("new variable", x);
      startActivity(i);
  }
  </code></pre>
  
  <p>For the receiving class, SecondActivity:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_second);
  
      Bundle i = getIntent().getExtras();
      String value = i.getString("new variable");
      tvResult = (TextView)findViewById(R.id.textViewResult);
      tvResult.setText(value);
  }
  </code></pre>
  
  <p>However, SecondActivity shows up with nothing on the second screen... Could it perhaps be because I need to convert value to an int first?</p>
  
  <p>Thanks!</p>