Skip to content Skip to sidebar Skip to footer

How To Call Any Activity From Fragment Android Studio Kotlin

can i call another Activity From Fragment Button ? I have seen all the problems in stackoverflow, but have not found a solution. this my fragment code from MainActivity package com

Solution 1:

Sure you can.

In order to launch an activity from your fragment, override the onViewCreated() method in your fragment. Inside it, type:

buttonImage2.setOnClickListener {
    val intent = Intent(context, SoalActivity::class.java)
    startActivity(intent)
}

And that's it :)

Post a Comment for "How To Call Any Activity From Fragment Android Studio Kotlin"