- I am trying to launch a compose function that I have in an Object class and trying to call in Normal activity rather than compose activity
- I am actually trying to build a VDS (UI library) in compose but I am trying to use it in normal activity. Things like popping SnackBar etc.
MainActivity1.kt
class MainActivity1 : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main1)
TestingCall()
}
}
TestingObject.kt
object TestingObject {
@Composable
public fun TestingCall() {
// Some UI that pops up
}
}
Error::
@Composable invocations can only happen from the context of a @Composable function