Created
May 26, 2018 14:42
-
-
Save shanmugasanthosh7/7a0ae0092ab059d11b3cb23e1bf3c94b to your computer and use it in GitHub Desktop.
Create bundle argument
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 BundleFragment : Fragment() { | |
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | |
savedInstanceState: Bundle?): View? { | |
return inflater.inflate(R.layout.fragment_bundle, container, false) | |
} | |
override fun onActivityCreated(savedInstanceState: Bundle?) { | |
super.onActivityCreated(savedInstanceState) | |
val bundle = Bundle() | |
bundle.putString("name", "Santhosh") | |
passBundle.setOnClickListener(Navigation.createNavigateOnClickListener(R.id.action_bundleFragment_to_passBundleFragment, bundle)) | |
//Or | |
// passBundle.setOnClickListener { | |
// val bundle = Bundle() | |
// bundle.putString("name","Santhosh") | |
// Navigation.findNavController(activity!!,R.id.my_nav_host_fragment).navigate(R.id.action_bundleFragment_to_passBundleFragment,bundle) | |
// } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment