-
-
Save hendrawd/63b2edb6828233e485bf2ec42f3fb9e7 to your computer and use it in GitHub Desktop.
Add private constructor from https://medium.com/@azjkjensen/using-the-newinstance-pattern-in-kotlin-e40c1b4ba1ef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyFragment private constructor() : Fragment(){ | |
companion object{ | |
private val ARG_CAUGHT = "myFragment_caught" | |
fun newInstance(caught: Pokemon):MyFragment{ | |
val args: Bundle = Bundle() | |
args.putSerializable(ARG_CAUGHT, caught) | |
val fragment = MyFragment() | |
fragment.arguments = args | |
return fragment | |
} | |
... | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment