Is this correct way to pass arguments in kotlin?
rajaasim opened this issue · comments
companion object{ fun newInstance(title: String) = FragmentChat().apply { arguments = Bundle().apply { putString("title", title) } } fun arguments(title: String): Bundle { return Bundler() .putString("title", title) .get() } }
override fun onAttach(context: Context?) { super.onAttach(context) callbacks = activity as OnFragmentCallbacks title = arguments?.getString("title") }
fragmentItems.add(FragmentPagerItem.of("Chat1", FragmentChat::class.java, FragmentChat.arguments("Chat1"))) adapter.notifyDataSetChanged()
It is working but i am still concerned as there is no kotlin way mentioned? Please respond ASAP
any updates on this?