Can anyone share their goto approach for Intent di...
# android
Can anyone share their goto approach for Intent dispatching using Kotlin? I've seen Context Extensions for instance
but that seems wrong given it's an extension on such a global object
For activities specifically, compares a couple different ideas with varying levels of cleverness. I tend toward a variation of the
strategy that starts the new activity right inside the function, kind of like:
Copy code
companion object {
        private val SOME_PARAMETER = "user_id"

        fun start(activity: Activity, param: Param) {
            val intent = Intent(activity,
            intent.putExtra(SOME_PARAMETER, param)
which makes the call site look like:
Copy code
SomeActivity.start(this, param)
Would love to hear what other people are doing too!