Ok, so right now i am making two activities talk to eachother with these lines of code:

In Main Activity: (Under a button onClick)

Intent i = new Intent(MainActivity.this,MyOtherActivity.class);

In the other activity:

Bundle extras = getIntent().getExtras();

if(extras!= null){
            int randomVariable = extras.getString("random");

The thing is, that every time the button gets pressed, the other activity starts up. But how can i do changes to the randomVariable in the second activity and get this working in the MainActivity?

Ive tried setting up another intent in the second activity that sends some information back to MainActivity, but this means that every time startActivity gets used, a "new" window pops up with the new variables. I want it to communicate back to the MainActivity once i do the changes needed to the randomVariable.
Is there a method such as continueActivity?

Its hard to explain what i mean! Im starting a second activity(a shop where you can buy upgrades) that gets some values from the MainActivity, and i want these upgrades from the second activity back to the main activity(where the upgrades will take effect). 
The way my app works now is that every time i go from the second activity and back to the main activity, i use the startActivity, which brings up a complete new main activity, which i guess is unnecessary.

Is there a better way to communicate between the activities than starting a new activity every time with the new values?

Hope my question makes sense:)