Skip to content

Instantly share code, notes, and snippets.

@ykro
Created November 10, 2017 21:20
Show Gist options
  • Save ykro/44ca83ef54df107aa0a3964f8048f600 to your computer and use it in GitHub Desktop.
Save ykro/44ca83ef54df107aa0a3964f8048f600 to your computer and use it in GitHub Desktop.
Android MVC
class Person(var firstName: String, var lastName: String) //model
class MainActivity : AppCompatActivity() { //view + controller
private var model: Person = Person("Adrian", "Catalan")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
btnShowGreet.setOnClickListener {
txtGreet.text =
"Hello ${model.firstName} ${model.lastName}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment