Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

get arguments in fragment kotlin

val frag = YourFragment()
        val bundle = Bundle()
        bundle.putString("Id", "001" )
        bundle.putString("Name", "Aman Thakur")
        frag.arguments = bundle
        requireActivity().supportFragmentManager
            .beginTransaction()
            .replace(R.id.fragmentContainerView_eng_test, frag)
            .commit()
  
  //in fragment get arguments in orCreate method or onViewCreated
  val id: String = requireArguments().getString("examId").toString()
 
PREVIOUS NEXT
Tagged: #arguments #fragment #kotlin
ADD COMMENT
Topic
Name
4+2 =