package Ġcom . example . github parser . ui Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . appcompat . widget . Toolbar Ċ import Ġandroidx . navigation . Nav Controller Ċ import Ġandroidx . navigation . fragment . Nav Host Fragment Ċ import Ġandroidx . navigation . ui . AppBar Configuration Ċ import Ġandroidx . navigation . ui . navigate Up Ċ import Ġandroidx . navigation . ui . setup With Nav Controller Ċ import Ġcom . example . github parser . R Ċ import Ġcom . google . android . material . bottomnavigation . Bottom Navigation View Ċ Ċ class ĠMainActivity Ġ: ĠAppCompatActivity () Ġ{ ĊĊ ĉ private Ġlateinit Ġvar Ġnav Controller : ĠNav Controller Ċ ĉ private Ġlateinit Ġvar Ġapp Bar Configuration : ĠApp Bar Configuration ĊĊ ĉ override Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ Ċĉ ĉ super . onCreate ( savedInstanceState ) Ċĉ ĉ set ContentView ( R . layout . activity _ main ) ĊĊĉ ĉ val Ġnav Host Fragment Ġ= Ġsupport FragmentManager . find Fragment ById ( Ċĉĉ ĉ R . id . container Ċĉ ĉ ) Ġas ĠNav Host Fragment Ċĉ ĉ nav Controller Ġ= Ġnav Host Fragment . nav Controller ĊĊĉ ĉ val Ġbottom Navigation View Ġ= ĠfindViewById < Bottom Navigation View >( R . id . bottom Navigation ) Ċĉ ĉ bottom Navigation View . setup With Nav Controller ( nav Controller ) ĊĊĉ ĉ app Bar Configuration Ġ= ĠApp Bar Configuration ( Ċĉĉ ĉ set Of ( R . id . repos Fragment , ĠR . id . profile Fragment ) Ċĉ ĉ ) Ċĉ ĉ val Ġtoolbar Ġ= ĠfindViewById < Toolbar >( R . id . toolbar ) Ċĉ ĉ set Support ActionBar ( toolbar ) Ċĉ ĉ toolbar . setup With Nav Controller ( nav Controller , Ġapp Bar Configuration ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Support Navigate Up (): ĠBoolean Ġ{ Ċĉ ĉ return Ġnav Controller . navigate Up ( app Bar Configuration ) Ċ ĉ } Ċ } Ċ