Created
September 15, 2020 12:32
-
-
Save iwata-n/e17f83466d996733d05d5245bc35933e to your computer and use it in GitHub Desktop.
androidxとDataBinding使った時のテンプレート
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TemplateFragment : Fragment(R.layout.template_fragment) { | |
companion object { | |
fun newInstance() = TemplateFragment() | |
} | |
private lateinit var viewModel: TemplateViewModel | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
val binding = TemplateFragmentBinding.bind(view) | |
} | |
override fun onActivityCreated(savedInstanceState: Bundle?) { | |
super.onActivityCreated(savedInstanceState) | |
viewModel = ViewModelProviders.of(this).get(TemplateViewModel::class.java) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment