Reputation: 196
I have created my own realm db and I set configuration to new RealmConfiguration.Builder(this).name("mydb.realm").build(); realm = Realm.getInstance(realmConfiguration);
The classToTable count is 0 and count of rows in the table is also 0. Can someone let me know what am I missing. Thanks.
Upvotes: 0
Views: 253
Reputation: 1028
Did you created your models as subsclasses of RealmObject
?
Follow sample to create some records in db:
Realm realm = Realm.getInstance(context);
// Define model
public class Dog extends RealmObject {
private String name;
private int age;
// ... Generated getters and setters ...
}
// Create object
Dog dog = new Dog();
dog.setName("Rex");
dog.setAge("1");
// Persist
realm.beginTransaction();
realm.copyToRealm(dog);
realm.commitTransaction();
Upvotes: 0