diff --git a/samples/add-features-with-contingent-values/src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt b/samples/add-features-with-contingent-values/src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt index a34965084..9d62f6c56 100644 --- a/samples/add-features-with-contingent-values/src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt +++ b/samples/add-features-with-contingent-values/src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/components/MapViewModel.kt @@ -75,9 +75,6 @@ class MapViewModel(application: Application) : AndroidViewModel(application) { // offline vector tiled layer to be used as a basemap private val fillmoreVectorTileLayer = ArcGISVectorTiledLayer("$provisionPath/FillmoreTopographicMap.vtpk") - // mobile database containing offline feature data - private val geodatabase = Geodatabase("${cacheDir.path}/ContingentValuesBirdNests.geodatabase") - // instance of the contingent feature to be added to the map private var feature: ArcGISFeature? = null @@ -102,6 +99,9 @@ class MapViewModel(application: Application) : AndroidViewModel(application) { // create a temporary directory for use with the geodatabase file createGeodatabaseCacheDir() + // create mobile database containing offline feature data + val geodatabase = Geodatabase("${cacheDir.path}/ContingentValuesBirdNests.geodatabase") + viewModelScope.launch { // retrieve and load the offline mobile geodatabase file from the cache directory geodatabase.load().getOrElse { @@ -163,8 +163,8 @@ class MapViewModel(application: Application) : AndroidViewModel(application) { } /** - * Geodatabase creates and uses various temporary files while processing a database, - * which will need to be cleared before looking up the [geodatabase] again. + * [Geodatabase] creates and uses various temporary files while processing a database, + * which will need to be cleared before looking up the geodatabase again. * A copy of the original geodatabase file is created in the cache folder. */ private fun createGeodatabaseCacheDir() {