How to pass and get value from fragment and activity

前端 未结 9 1253
独厮守ぢ
独厮守ぢ 2020-12-25 11:28

How to pass and get value from fragment and activity?

9条回答
  •  旧巷少年郎
    2020-12-25 12:14

    simple way to call in java ....like this way

    class ViewStackListFragment : Fragment() {
      companion object {
            fun newInstance(position: Int): ViewStackListFragment {
                val fragment = ViewStackListFragment()
                val args = Bundle()
                args.putInt("position", position)
                fragment.setArguments(args)
                return f
            }
    }
    

    }

提交回复
热议问题