Intent with companion Object

companion object {
    fun launchNewActivity(activity: Activity) {
        val intent = Intent(activity, LauncherActivity::class.java)
        intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK        ActivityCompat.startActivity(
            activity,
            intent,
            null        )
    }
}

To access this activity call from Other activity


LauncherActivity.launchNewActivity(this)

0 comments: