您好,我有兩個活動去一個活動。當活動打開有一個數字顯示從兩個活動如何知道哪個意圖打開活動
我需要知道數字來自哪裏,所以我可以做適當的計算,我想我需要一個if語句,但不知道如何啓動它
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);
三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));
「我心中已經有兩個活動,去一個活動」 - 做什麼你意思是? – 2013-04-09 20:23:09