a guest Feb 21st, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. inline fun <reified T : MyClass> android.arch.lifecycle.LifecycleOwner.createMyClassInstance(parameter: String): T {
  2.     val instance = T::class.constructors.first { it.parameters.isNotEmpty() }.call(parameter)
  3.     // Don't forget to invoke removeObserver(instance)!
  4.     lifecycle.addObserver(instance)
  5.     return instance
  6. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand