I am new to android and have the following query.
I am building an app, which contains 2 activities first and second which send messages to each other. 'first' sends a message to 'second' and then 'second' starts, displays the message received and sends back a message to 'first'. Finally first displays the message received.
In the first activity i have to start the second activity using startActivityForResult since i need a response back.
Question - when overriding onActivityResult why do we have to check if(resultCode == RESULT_OK)
According to the android website -
onActivityResult is "Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it. "
So if i have the set the ResultCode to Result_OK in 'second activity', why do i have to check resultCode in 'first' activity. ? Isnt onActivityResult called when the 'second' sets the resultCode and exits ?
Thanks !
PS - i have tried removing the statement - if(resultCode == RESULT_OK) . I get a NullPointerException.