0

I have 2 Activities, say activity A and activity B. I have to call activity B from the activity A. Now that is done by using Intent. There is some code in the activity A that must be executed after activity B ends. How can that be done?

I use the following code :

Intent intent = new Intent(A.this, B.class);
startActivity(intent);
finish();

How can i accomplish that?

Chintan Mehta
  • 129
  • 1
  • 9

1 Answers1

0

According to Android Docs: "Starting another activity doesn't have to be one-way. You can also start another activity and receive a result back. To receive a result, call startActivityForResult() (instead of startActivity())."

Activity For Result Doc

And here you have a question about Activity For Result where you will find an example.

willermo
  • 503
  • 3
  • 13