Last active
March 12, 2020 15:40
-
-
Save cribetti/9166b3659942b8967167572a134ff1e5 to your computer and use it in GitHub Desktop.
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 : Fragment() { | |
private lateinit var arg: String | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
arguments?.getString(ARG) ?: "" | |
} | |
companion object { | |
fun newInstance(arg: String) = | |
MyFragment().apply { | |
arguments = Bundle().apply { | |
putString(ARG, arg) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment