How to total two int values from two different activities in 3rd?

alimcm1

New Member
I have a button with setText value set to 0 on activity created. It's 0 cause I total two int values, valueA and valueB that are 0 at game start. After another activity ends my valueA is now set to some public static int value in ActivityClassA, lets say 100. I need now when that activity ends to change that 0 value to new valueA+valueB value,100 + 0 = 100. I guess I should do this in onResume method, so I placed it there, and that's working fine.\[code\]button.setText("" + ActivityClassA.valueA + ActivityClassB.valueB);\[/code\]But now I have activity2 starting and after that activity ends I have public static int valueB in ActivityClassB that's lets say 500. Now I need to update that sum value that is valueA+valueB to be 100+500=600. But now, my sum value is 500. And that's my problem.I always get last set value as a total. If I start first ActivityB and then A, I would get total of 100.
 
Top