Will someone please explain RESULT_FIRST_USER

前端 未结 4 1033
甜味超标
甜味超标 2020-12-29 19:14

I don\'t understand the meaning, value, or importance of RESULT_FIRST_USER, other than that my own result codes must be greater than 1. Will someone please expl

4条回答
  •  太阳男子
    2020-12-29 20:07

    When an activity ends, it can call setResult(int) to return data back to its parent.

    It must always supply a result code, which can be the standard results

    • RESULT_CANCELED (Standard activity result: Operation canceled. Constant Value: 0)
    • RESULT_OK (Standard activity result: operation succeeded. Constant Value: -1), or any custom values starting at RESULT_FIRST_USER (Start of user-defined activity results. Constant Value: 1). In addition, it can optionally return back an Intent containing any additional data it wants.

    So, bottom line since you must supply the result code Android "helps' you a bit by saying: please state if the result code of this Activity is OK, CANCELED or you have your own, custom made, result.

提交回复
热议问题