title: Send float from activity to activity
body: <p>I'm beginning android developpement and i don't why my code is not working. The aim is simple : I have a main activity, a menu and a second activity. I want to send a float value from the main to the second activity and .. it's not working !</p>
  
  <p>Here is my code from the main :</p>
  
  <pre><code>public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
      case R.id.menu_about:
          Intent intent = new Intent(MainActivity.this, AboutActivity.class);
          startActivity(intent);
  
          return true;
      case R.id.menu_home:
  
          return true;
      case R.id.menu_settings:        
          intent = new Intent(MainActivity.this, SettingsActivity.class);
          startActivity(intent);
  
          return true;
      case R.id.menu_battstat:
          intent = new Intent(MainActivity.this, StatsActivity.class);
          intent.putExtra("consumOn", 4);
          intent.putExtra("consumOff", 5);
          startActivity(intent);
  
          return true;
      default:
          return super.onOptionsItemSelected(item);
      }
  
  }
  </code></pre>
  
  <p>And the StatsActivity.class</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.stats_main);
  
      Intent intent = getIntent();
  
      float consumOn  = intent.getFloatExtra("consumOn", 0);
      float consumOff = intent.getFloatExtra("consumOff", 0);
  
      EditText editTextA = (EditText)findViewById(R.id.editText1);
      editTextA.setText(String.valueOf(consumOn), TextView.BufferType.EDITABLE);
  
      EditText editTextB = (EditText)findViewById(R.id.editText2);
      editTextB.setText(String.valueOf(consumOff), TextView.BufferType.EDITABLE);
  } 
  </code></pre>
  
  <p>When I launch my code, it stills 0 and not a 4 and 5. Any ideas ? Thx.</p>