package Ġcom . example . hello paging 1 . view model Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroidx . lifecycle . Android ViewModel Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . paging . Paged List Ċ import Ġandroidx . paging . to LiveData Ċ import Ġcom . example . hello paging 1 . model . Crypt oc urrencies Dao Ċ import Ġcom . example . hello paging 1 . model . Crypt oc urrencies Database Ċ import Ġcom . example . hello paging 1 . model . Crypt oc urrency Model ĊĊ Ċ class ĠCrypt oc urrencies ViewModel ( app : ĠApplication ): ĠAndroid ViewModel ( app ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġdatabase Ġ: ĠCrypt oc urrencies Database ĊĠĠĠ Ġprivate Ġval Ġcrypt oc urrencies Dao Ġ: ĠCrypt oc urrencies Dao ĊĠĠĠ Ġprivate Ġval Ġcrypt oc urrencies Ġ: ĠLive Data < Paged List < Crypt oc urrency Model >> ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġdatabase Ġ= ĠCrypt oc urrencies Database . getInstance ( app ) ĊĠĠĠĠĠĠĠ Ġcrypt oc urrencies Dao Ġ= Ġdatabase . crypt oc urrencies Dao () ĊĠĠĠĠĠĠĠ Ġcrypt oc urrencies Ġ= Ġcrypt oc urrencies Dao . getAll Crypt oc urrencies (). to LiveData ( pageSize = 1 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Crypt oc urrencies (): ĠLive Data < Paged List < Crypt oc urrency Model >> Ġ= Ġcrypt oc urrencies Ċ }