Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this correct way to pass arguments in kotlin? #292

Open
rajaasim opened this issue Sep 24, 2019 · 1 comment
Open

Is this correct way to pass arguments in kotlin? #292

rajaasim opened this issue Sep 24, 2019 · 1 comment

Comments

@rajaasim
Copy link

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

@kartik1225
Copy link

any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants