Skip to content

Instantly share code, notes, and snippets.

@dhruvtaneja
Created June 5, 2019 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhruvtaneja/ecfa34fcad6f7bab2d6d56419aae245b to your computer and use it in GitHub Desktop.
Save dhruvtaneja/ecfa34fcad6f7bab2d6d56419aae245b to your computer and use it in GitHub Desktop.
Handling user's action in onActivityResult
companion object {
private const val REQUEST_CODE_FLEXI_UPDATE = 17362
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_CODE_FLEXI_UPDATE) {
when (resultCode) {
Activity.RESULT_OK -> { // handle user's approval }
Activity.RESULT_CANCELED -> { // handle user's rejection }
ActivityResult.RESULT_IN_APP_UPDATE_FAILED -> { // handle update failure }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment