package Ġcom . fr 1 x 3 . in vo icing an . ui Ċ Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . MenuItem Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . navigation . Nav Controller Ċ import Ġandroidx . navigation . Nav Host Ċ import Ġandroidx . navigation . find Nav Controller Ċ import Ġandroidx . navigation . ui . on Nav Destination Selected Ċ import Ġandroidx . navigation . ui . setup With Nav Controller Ċ import Ġcom . fr 1 x 3 . in vo icing an . R Ċ import Ġcom . fr 1 x 3 . in vo icing an . databinding . Activity Main Binding Ċ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġlateinit Ġvar Ġ Ġnav Controller : ĠNav Controller ĊĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġval Ġbinding Ġ: Ġ ĠActivity Main Binding Ġ= ĠData Binding Util . set ContentView ( this , ĠR . layout . activity _ main ) ĊĊĠĠĠĠĠĠĠ Ġval Ġnav Host Fragment Ġ= Ġsupport FragmentManager . find Fragment ById ( R . id . nav _ host _ fragment ) Ġ Ġas ĠNav Host ĊĠĠĠĠĠĠĠ Ġnav Controller Ġ= Ġnav Host Fragment . nav Controller ĊĊĠĠĠĠĠĠĠ Ġ// setup Ġnavig tion Ġfor Ġnav Ġcontroller ĊĠĠĠĠĠĠĠ Ġbinding . bottom Navigation . setup With Nav Controller ( nav Controller ) ĊĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Options ItemSelected ( item : ĠMenuItem ): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġ Ġitem . on Nav Destination Selected ( nav Controller ) Ġ|| ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsuper . on Options ItemSelected ( item ) ĊĠĠĠ Ġ} Ċ }