I have a listview in Activity A. I want to sum up the total amount which are return from Activity B to Activity A, but I have no idea on how to add them up.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PROJECT_REQUEST_CODE) {
ReceiveAmount = data.getStringExtra("amount");
Toast.makeText(getApplication(),"Total Amount is"+ReceiveAmount,LENGTH_SHORT).show();
}
}
}
}
Assume in Activity B I return amount 5, then I go to Activity B again and return value 10. I want the toast display value 15 instead of always 5.
Edited
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PROJECT_REQUEST_CODE) {
double sum = 0;
ReceiveAmount = data.getStringExtra("amount");
sum = + ReceiveAmount;
Toast.makeText(getApplication(),"Total Amount is"+sum,LENGTH_SHORT).show();
}
}
}
}
What I have tried:
Google but no answer found. Thanks