package Ġcom . ble acher report . ve loc id apter demo . parent child Ċ Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . util . Log Ċ import Ġcom . ble acher report . ve loc id apter annotations .* Ċ import Ġcom . ble acher report . ve loc id apter demo . MainActivity Ċ import Ġcom . ble acher report . ve loc id apter demo . databinding . Item String Binding Ċ Ċ @ ViewHolder ( adapters Ġ= Ġ[ MainActivity . Parent Child Adapter ]) Ċ class ĠChild ViewHolder ( binding : ĠItem String Binding ) Ġ: ĠParent ViewHolder ( binding ) Ġ{ ĊĊĠĠĠ Ġ@ Suppress Lint (" SetText I 1 8 n ") ĊĠĠĠ Ġ@ Bind ĊĠĠĠ Ġfun Ġbind Model ( model : ĠChild P oko , Ġposition : ĠInt ) Ġ{ ĊĠĠĠĠĠĠĠ Ġbinding . textView . text Ġ= Ġ" Child P oko Ġ${ model . string }" ĊĠĠĠĠĠĠĠ Ġlist Position Ġ= Ġposition ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ On Attach To Window ĊĠĠĠ Ġoverride Ġfun Ġon Attach To Window () Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . d (" Child ViewHolder ", Ġ"$ list Position Ġattached Ġto Ġwindow ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ On Detach From Window ĊĠĠĠ Ġoverride Ġfun Ġon Detach From Window () Ġ{ ĊĠĠĠĠĠĠĠ ĠLog . d (" Child ViewHolder ", Ġ"$ list Position Ġfrom Ġwindow ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Un bind ĊĠĠĠ Ġfun Ġun bind Model () Ġ{ ĊĠĠĠĠĠĠ ĠLog . i (" Child ViewHolder ", Ġ"$ list Position Ġun bound " Ġ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠChild P oko ( string : ĠString ) Ġ: ĠParent P oko ( string )