Skip to content

Instantly share code, notes, and snippets.

@plnice
Created March 19, 2020 17:27
Show Gist options
  • Save plnice/6c5230f58a62c259dceb990f539db3a7 to your computer and use it in GitHub Desktop.
Save plnice/6c5230f58a62c259dceb990f539db3a7 to your computer and use it in GitHub Desktop.
Simple call using Activity Results APIs
class MyActivity : AppCompatActivity() {
private val myActionCall = prepareCall(MyContract()) { result ->
Log.i("MyActivity", "Obtained result: $result")
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
button.setOnClickListener {
myActionCall(500)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment