in a transaction to facilitate safe multi threading realm.beginTransaction(); // Add a person Person person = realm.createObject(Person.class); person.setName("Young Person"); person.setAge(14); realm.commitTransaction(); RealmResults<User> result = realm.where(User.class) .greaterThan("age", 10) // implicit AND .beginGroup() .equalTo("name", "Peter") .or() .contains("name", "Jo") .endGroup() .findAll();
bar = new Bar(); // or Bar.getInstance() bar.something(); } } new Foo(); // Better class Foo { public Foo(Bar bar) { bar.something(); } } new Foo(new Bar());