Skip to content

Instantly share code, notes, and snippets.

@weverb2
Created January 22, 2019 00:54
Show Gist options
  • Save weverb2/e716d333490e0f8fb8e94c2108f28d43 to your computer and use it in GitHub Desktop.
Save weverb2/e716d333490e0f8fb8e94c2108f28d43 to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
lateinit var viewModel: MainViewModel
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
username.doAfterTextChanged { text -> viewModel.username = text?.toString() ?: "" }
password.doAfterTextChanged { text -> viewModel.password = text?.toString() ?: "" }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment