title: How to pass an integer from one activity to another in android application
body: <p>I am trying to learn android and i don't know how to pass data from one activity to another</p>
  <pre><code> public void onNextClick(View view){
      Intent intent = new Intent(this,Expenses.class);
      intent.putExtra(EXTRA_SUM, sum);
      startActivity(intent);
  
      editSalary = (EditText) findViewById(R.id.salayText);
      editIncome = (EditText) findViewById(R.id.incomeText);
      salary = Integer.parseInt(editSalary.getText().toString());
      income = Integer.parseInt(editIncome.getText().toString());
      sum = salary + income;
  }
  
  
      public void onNextClick2(View view){
      Intent intent2 = new Intent(Expenses.this,Budget.class);
      intent2.putExtra(EXTRA_EXPENSE, expense);
      startActivity(intent2);
  
      editRent = (EditText) findViewById(R.id.rentText);
      editBills = (EditText) findViewById(R.id.billsText);
      editEveryday = (EditText) findViewById(R.id.everydayText);
      editOther = (EditText) findViewById(R.id.otherText);
      rent = Integer.parseInt(editRent.getText().toString());
      bills = Integer.parseInt(editRent.getText().toString());
      everyday = Integer.parseInt(editEveryday.getText().toString());
      other = Integer.parseInt(editOther.getText().toString());
      expense = rent + bills + everyday + other;
  }
  
  
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_budget);
  
      Intent intent = getIntent();
      summary =  intent.getIntExtra(MainActivity.EXTRA_SUM ,0);
      expenses = intent.getIntExtra(Expenses.EXTRA_EXPENSE, 0);
      totalBudget = summary - expenses;
      textBudget = (TextView) findViewById(R.id.budgetView);
      textBudget.setText(String.valueOf(totalBudget));
  }
  </code></pre>
  <p>I am trying to get &quot;sum&quot; from activity 1 and &quot;expenses&quot; from activity 2 and subtract them in activity 3 but i keep getting null</p>