1. Get result after navigationUp in the previous fragment
setFragmentResultListener("requestKey") { requestKey, bundle ->
// We use a String here, but any type that can be put in a Bundle is supported
val result = bundle.getParcelable<Address>("bundleKey")
Toast.makeText(context, "$result", Toast.LENGTH_SHORT).show()
}
1. Set data for getting results in the previous fragment
val data = arguments?.getParcelable<Address>(AppConstants.DataTask.DATA)
Timber.e("data : $data")
binding.detail.setOnClickListener {
errorLog("detailFragment")
setFragmentResult("requestKey", bundleOf("bundleKey" to Address("Dhaka", "1205")))
it?.findNavController()?.navigateUp()
}
0 comments:
Post a Comment