How to startActivityForResult by implict intent in Anko?


#1

Such as title.Implicit intent can be used in startActivity,how to be used in startActivityForResult?


#2
  1. Create Singleton class for application instance for example :

class MyApp: Application() {

override fun onCreate() {
    super.onCreate()
    instance = this
}

companion object {
    lateinit var instance: MyApp
        private set
}

}

  1. then after call it where you required application object instance. for example :
val intent: Intent = Intent(MyApp.instance, DestinationActivity::class.java);
MyApp.instance.startActivity(intent)

Hope this will help to implict in anko


#3

Thanks.I already solved this problem.