Guest User

Untitled

a guest
Oct 22nd, 2019
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private const val ARG_PARAM1 = "param1"
  2. private const val ARG_PARAM2 = "param2"
  3.  
  4. class FugaFragment : Fragment() {
  5. private var param1: String? = null
  6. private var param2: String? = null
  7.  
  8. ...
  9. override fun onCreate(savedInstanceState: Bundle?) {
  10. super.onCreate(savedInstanceState)
  11. arguments?.let {
  12. param1 = it.getString(ARG_PARAM1)
  13. param2 = it.getString(ARG_PARAM2)
  14. }
  15. }
  16.  
  17. ...
  18. companion object {
  19. @JvmStatic
  20. fun newInstance(param1: String, param2: String) =
  21. FugaFragment().apply {
  22. arguments = Bundle().apply {
  23. putString(ARG_PARAM1, param1)
  24. putString(ARG_PARAM2, param2)
  25. }
  26. }
  27. }
  28. }
RAW Paste Data