When I try using startActivity inside onCreate() function inside any Activity class, It works without any problem. But when I need to use it inside any function that I call indirectly inside Activity class, Its color will be red and I get this error:
Unresolved reference: startActivity
val intent = Intent(instance.applicationContext, MainActivity::class.java)
startActivity(intent)
Note: I am using instance as an imported argument in Global class constructor.
Could anyone help please?