package Ġcom . ser ge y rod in . matches boxes Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . navigation . Nav Controller Ċ import Ġandroidx . navigation . fragment . Nav Host Fragment Ċ import Ġandroidx . navigation . ui . Navigation UI Ċ import Ġandroidx . navigation . ui . setup With Nav Controller Ċ import Ġcom . google . android . material . bottomnavigation . Bottom Navigation View Ċ import Ġdagger . h ilt . android . Android EntryPoint Ċ Ċ const Ġval ĠADD _ NEW _ ITEM _ ID Ġ= Ġ- 1 Ċ const Ġval ĠDO _ NOT _ NEED _ THIS _ VARIABLE Ġ= Ġ- 1 Ċ Ċ @ Android EntryPoint Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ main ) ĊĠĠĠĠĠĠĠ Ġval Ġnav Controller Ġ= Ġget Nav Controller () ĊĠĠĠĠĠĠĠ ĠNavigation UI . setup ActionBar With Nav Controller ( this , Ġnav Controller ) ĊĠĠĠĠĠĠĠ ĠfindViewById < Bottom Navigation View >( R . id . bottom _ nav ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. setup With Nav Controller ( nav Controller ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Support Navigate Up (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnav Controller Ġ= Ġget Nav Controller () ĊĠĠĠĠĠĠĠ Ġreturn Ġnav Controller . navigate Up () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget Nav Controller (): ĠNav Controller Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnav Host Fragment Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsupport FragmentManager . find Fragment ById ( R . id . my _ nav _ host _ fragment ) Ġas ĠNav Host Fragment ĊĠĠĠĠĠĠĠ Ġreturn Ġnav Host Fragment . nav Controller ĊĠĠĠ Ġ} Ċ } Ċ