Posts

Showing posts with the label Activity Result

Get the Result From Last Activity When Middle Activity Is Finished

We usually get the result from an activity by starting it with startActivityForResult() and listening to the onActivityResult() in the calling activity. But there are some cases, where we may want the result to be received from the subsequent activities rather than the immediately invoked activity. For example, let's take three activities named FirstActivity , SecondActivity (middle activity) and ThirdActivity (last activity). They have a feature through which the first activity opens the second activity and the second activity opens the third activity closing itself. Now, the third activity has to send the result back to the first activity. In this article, we will take a look at this scenario where we have to send the result from the last activity and read it in the first activity. As usual, we start the middle activity for the result from the first activity. // Open the middle activity startActivityForResult( Intent(context, SecondActi...