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

前端 未结 4 1065
失恋的感觉
失恋的感觉 2020-12-16 11:09

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

Th

4条回答
  •  被撕碎了的回忆
    2020-12-16 11:28

    Read Following:

    public void finish ()

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

    public void finishActivity (int requestCode)

    Force finish another activity that you had previously started with startActivityForResult(Intent, int).

    For further reading have a look at the documentation.

提交回复
热议问题