Hi i'v got two activities going to one activity. When the activity is opened there is a number displayed from either of the two activities
I need to know where the number came from so I can do the appropriate calculations, I think i need an if statement but don't know how to start it
Intent intent = new Intent(calculateA.this,
WAmounts.class);
intent.putExtra("Result",Total);
startActivity(intent);
Intent intent = new Intent(CalcB.this,
WAmounts.class);
intent.putExtra("ResultB",Total);
startActivity(intent);
Third activiity
Intent sender = getIntent();
int result = sender.getExtras().getInt("Result");
answer.setText(result+"");
int resultB = sender.getExtras().getInt("ResultB");
answer.setText(resultB+"");
//If number came from first activity
a = Integer.parseInt (answer.getText().toString());
total = (float) (a *x);
sd.setText(String.format("%.1f" ,total));
b = Float.parseFloat (sand.getText().toString());
total1 = (int)Math.ceil (b*f);
c.setText(Integer.toString(total1));
//If number came from second activity
a = Integer.parseInt (answer.getText().toString());
total = (float) (a *x);
sd.setText(String.format("%.1f" ,total));
b = Float.parseFloat (sand.getText().toString());
total1 = (int)Math.ceil (b*f);
c.setText(Integer.toString(total1));