eugene
eugene

Reputation: 41685

android onActivityResult vs getIntent

Both onActivityResult and getIntent receives intent from other activities.

when one is used over another?

I think onActivityResult is called after I call startActivityForResult to receive a result.

I guess then getIntent is used to receive intent which was sent by someone other than me. Is it correct?

Below is my understanding how it's used, wonder if the understanding is correct.

Upvotes: 0

Views: 352

Answers (1)

Blackbelt
Blackbelt

Reputation: 157457

I think onActivityResult is called after I call startActivityForResult to receive a result.

on onActivityResult is called when you finish() the Activity that you started with startActivityForResult. You can provide an Intent to setResult, which you will get back as part of onActivityResult

I guess then getIntent is used to receive intent which was sent by someone other than me. Is it correct?

getIntent() returns the intent that started the current Activity

Upvotes: 3

Related Questions