I started working on the logic of my migration using this code: https://github.com/realm/realm-java/blob/master/examples/migrationExample/src/main/java/io/realm/examples/realmmigrationexample/MigrationExampleActivity. java
And after writing the code, I get an error message on this line:
String path3 = MigrationClass.copyBundledRealmFile(this, this.getResources().openRawResource(R.raw.default1), "default1");
It cannot find the R.raw.default1 file, since so far I have used Realm as a rule:
Realm realm = Realm.getInstance(context);
My question is, where can I get the file path for this realm file?
Realm getFilesDir(), Realm default.realm. :
getFilesDir()
default.realm
String realmPath = new File(context.getFilesDir(), "default.realm").getAbsolutePath(); Realm.migrateRealmAtPath(realmPath, new CustomMigration());
realm, getPath():
:
realm.getPath()
Source: https://habr.com/ru/post/1584285/More articles:General variable with raspberry GPIO callback function - pythonUsing main in a Haskell file - haskellCommand Commands in the Laravel Artisan Scheduler? - phpHow to specify ServiceHostFactory for a standalone WCF service without an SVC file - c #Расширение рекурсивных функций в Coq - computer-scienceCreating a binary tree from a list of lists in Python - pythonHow to use Goutte to submit a form and get the final URI? - phpBlue image for buttons - iosCreating a listener in IBM WebSphere MQ v5.3 - ibm-mqHow to make ol.source.ImageWMS by sending a POST request - openlayers-3All Articles