Skip to content

Instantly share code, notes, and snippets.

@anangkur
Created October 28, 2021 09:02
Show Gist options
  • Save anangkur/0a2b44bfe586ba6eeecc40e6a82aba5c to your computer and use it in GitHub Desktop.
Save anangkur/0a2b44bfe586ba6eeecc40e6a82aba5c to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
companion object {
const val QUERY_COMPONENT = "component"
const val COMPONENT_BUTTON = "button"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
handleIntent(intent.data?.getQueryParameter(QUERY_COMPONENT))
}
private fun handleIntent(component: String?) {
when (component) {
COMPONENT_BUTTON -> startActivity(Intent(this, ButtonActivity::class.java))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment