Skip to content

Instantly share code, notes, and snippets.

@douglasiacovelli
Last active May 3, 2018 13:30
Show Gist options
  • Save douglasiacovelli/45f0fe99f57fce66a5082f75760c5854 to your computer and use it in GitHub Desktop.
Save douglasiacovelli/45f0fe99f57fce66a5082f75760c5854 to your computer and use it in GitHub Desktop.
class ListActivity: AppCompatActivity {
private val REQUEST_FORM = 1
onCreate(...){...}
fun startFormActivity() {...}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
// check if the requestCode is the wanted one and if the result is what we are expecting
if (requestCode == REQUEST_FORM && resultCode == RESULT_OK) {
val name = data?.getStringExtra(FormActivity.INPUT_NAME)
addItemToList(name) // do something with the value
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment