activityId: String override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) ... activityId = getActivityId(savedInstanceState) scope = Toothpick.openScopes(application, activityId) } private fun getActivityId(savedInstanceState: Bundle?): String { return savedInstanceState?.getString("activity_id") ?: UUID.randomUUID().toString() } }