📜  Android Navigation 组件将数据从活动传递到片段 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:11.688000             🧑  作者: Mango

代码示例1
def nav_version = "2.3.5"
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
id("androidx.navigation.safeargs")
        
override fun onClick(v: View) {
   val amountTv: EditText = view!!.findViewById(R.id.editTextAmount)
   val amount = amountTv.text.toString().toInt()
   val action = SpecifyAmountFragmentDirections.confirmationAction(amount)
   v.findNavController().navigate(action)
}