Android – Whats the difference between finish() and finishActivity(int requestCode) in android

android

Can anyone explain me the difference between finish() and finishActivity(int requestCode). And the situation of where to use them aptly.

Thanks in advance.

Best Answer

finish() Call this when your activity is done and should be closed. The ActivityResult is propagated back to whoever launched you via onActivityResult().

finishActivity(int requestCode) is used to finish another activity that you had previously started with startActivityForResult(Intent, int)