Ċ package Ġcom . example . android . databinding . basics ample . ui Ċ Ċ import Ġandroid . arch . lifecycle . ViewModel Providers Ċ import Ġandroid . databinding . Data Binding Util Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . support . v 7 . app . AppCompatActivity Ċ import Ġcom . example . android . databinding . basics ample . R Ċ import Ġcom . example . android . databinding . basics ample . data . Simple ViewModel Ċ import Ġcom . example . android . databinding . basics ample . databinding . Plain Activity Binding Ċ Ċ /** Ċ Ġ* ĠPlain Ġold Ġactivity Ġwith Ġlots Ġof Ġproblems Ġto Ġfix . Ċ Ġ*/ Ċ class ĠPlain Old Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġ// ĠObtain ĠViewModel Ġfrom ĠViewModel Providers ĊĠĠĠ Ġprivate Ġval ĠviewModel Ġby Ġlazy Ġ{ ĠViewModel Providers . of ( this ). get ( Simple ViewModel :: class . java ) Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġval Ġbinding Ġ: ĠPlain Activity Binding Ġ= ĠData Binding Util . set ContentView ( this , ĠR . layout . plain _ activity ) ĊĠĠĠĠĠĠĠ Ġbinding . view model Ġ= ĠviewModel ĊĠĠĠ Ġ} Ċ Ċ } Ċ