@ file : Suppress (" DE PREC ATION ") Ċ Ċ package Ġorg . kode in . di . android Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . app . Fragment Ċ import Ġandroid . os . Bundle Ċ import Ġorg . kode in . di . K ode in Ċ Ċ /** Ġ@ suppress Ġ*/ Ċ class ĠRet ained K ode in Fragment Ġ: ĠFragment () Ġ{ ĊĊĠĠĠ Ġvar Ġk ode in : ĠK ode in ? Ġ= Ġnull ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĊĠĠĠĠĠĠĠ Ġretain Instance Ġ= Ġtrue ĊĠĠĠ Ġ} Ċ Ċ } Ċ Ċ private Ġconst Ġval Ġk ode in Ret ained Fragment Tag Ġ= Ġ" org . kode in . di . android . Ret ained K ode in Fragment " Ċ Ċ /** Ċ Ġ* ĠA ĠK ode in Ġinstance Ġthat Ġwill Ġbe Ġretained Ġbetween Ġactivity Ġchanges . Ċ Ġ* Ċ Ġ* Ġ@ property Ġallow Sil ent Override ĠWhether Ġthis Ġmodule Ġis Ġallowed Ġto Ġnon - explicit Ġoverrides . Ċ Ġ* Ġ@ property Ġinit ĠThe Ġblock Ġof Ġconfiguration Ġfor Ġthis Ġmodule . Ċ Ġ*/ Ċ fun ĠActivity . ret ained K ode in ( allow Sil ent Override : ĠBoolean Ġ= Ġfalse , Ġinit : ĠK ode in . Main Builder . () Ġ-> ĠUnit ): ĠLazy < K ode in > Ġ= Ġlazy Ġ{ ĊĠĠĠ Ġ( fragment Manager . find Fragment By Tag ( kode in Ret ained Fragment Tag ) Ġas ? ĠRet ained K ode in Fragment )?. kode in ?. let Ġ{ Ġreturn @ lazy Ġit Ġ} ĊĊĠĠĠ Ġval Ġk ode in Ġ= ĠK ode in ( allow Sil ent Override , Ġinit ) ĊĠĠĠ Ġval Ġfragment Ġ= ĠRet ained K ode in Fragment () ĊĠĠĠ Ġfragment . kode in Ġ= Ġk ode in ĊĠĠĠ Ġfragment Manager . beginTransaction (). add ( fragment , Ġk ode in Ret ained Fragment Tag ). commit () ĊĊĠĠĠ Ġreturn @ lazy Ġk ode in Ċ } Ċ