awesomeoxc
awesomeoxc

Reputation: 3

Realm DataBase file path can not be modified. Does anyone know why this is, or how to solve it?

I am learning to use Realm database, I found. Realm file path can not be modified. Does anyone know why this is, or how to solve it?

Upvotes: 0

Views: 616

Answers (1)

geisshirt
geisshirt

Reputation: 2497

You can specify the directory where your Realm is stored using https://realm.io/docs/java/latest/api/io/realm/RealmConfiguration.Builder.html#directory-java.io.File-. For example:

Realm.init(context);
RealmConfiguration config = new RealmConfiguration.Builder()
   .directory("store/it/here")
   .name("my-realm-file")
   .build();
Realm realm = Realm.getInstance(config);

Upvotes: 1

Related Questions