override fun onViewCreated(view: View, savedInstanceState: Bundle?){ super.onViewCreated(view, savedInstanceState)
var cal: Calendar = Calendar.getInstance() var year = cal.get(Calendar.YEAR) var month = cal.get(Calendar.MONTH) var day = cal.get(Calendar.DAY_OF_MONTH) Toast.makeText(requireContext(),"for test", Toast.LENGTH_SHORT).show() **btn_cal.setOnClickListener { val pickdate = DatePickerDialog( requireContext(), DatePickerDialog.OnDateSetListener { view, y: Int, m: Int, d: Int -> text_cal.setText("${y}년 ${m + 1}월 ${d}일") }, year, month, day ) pickdate.show() }** navController = Navigation.findNavController(view) btn_home01.setOnClickListener { navController.navigate(R.id.action_fragment_one_to_fragment_home) } }
https://stackoverflow.com/questions/66947193/how-can-i-save-the-value-of-year-month-and-day-of-datepickerdialog-into-r April 05, 2021 at 09:06AM
没有评论:
发表评论