Here is what I want:
- In Activity No.1. some variables receive values (variable A and B)
- Here the user launches Activity No.2. and sets a variable (variable C)
- User presses a button that takes him back to Activity No.1.
- Activity No.1. has now the value of all the three variables.
I can pass the variables to Activity No.2. with an intent and retrieve them there using a Bundle. But is it an appropriate way to open Activity No.1. by using basically the same lines that I used to start Activity No.2?
In Activity No.1:
Intent intent = new Intent(getApplicationContext(), ActivityNo2.class);
intent.putExtra("date", date);
intent.putExtra("filename", filename);
startActivity(intent);
In Activity No.2:
Bundle bundle = getIntent().getExtras();
String date = bundle.getString("date");
String filename = bundle.getString("filename");
String variableC = "somevalue";
What's the best way to return to Activity No.1. with the new variable?