package Ġcom . an sh ul . ther o ad runner . home Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . ViewModel Provider ĊĊ Ċ class ĠHome Fragment ViewModel Factory ( ĊĠĠĠ Ġprivate Ġval Ġapplication : ĠApplication Ċ ) Ġ: ĠViewModel Provider . Factory Ġ{ ĊĠĠĠ Ġ@ Suppress (" unchecked _ cast ") ĊĠĠĠ Ġoverride Ġfun Ġ< T Ġ: ĠViewModel ?> Ġcreate ( model Class : ĠClass < T >): ĠT Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( model Class . isAssignableFrom ( Home Fragment ViewModel :: class . java )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠHome Fragment ViewModel ( application ) Ġas ĠT ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" Unknown ĠViewModel Ġclass ") ĊĠĠĠ Ġ} Ċ }