protected void filteredEventsList() { String maxFree = ((FeedActivity)getActivity()).getMaxFree(); int resultMaxFree = Integer.parseInt(maxFree); Realm realm = Realm.getDefaultInstance(); RealmResults<Event> eventRealmResults = realm.where(Event.class).equalTo("highestPrice", resultMaxFree).findAllSorted("startDate", Sort.ASCENDING); events = (ArrayList<Event>)realm.copyFromRealm(eventRealmResults.subList(0, eventRealmResults.size())); ((EventsListAdapter)eventsListView.getAdapter()).updateData(events); realm.close(); } 

How can I add a check "from" - "to" to this line.

 RealmResults<Event> eventRealmResults = realm.where(Event.class).equalTo("highestPrice", resultMaxFree).findAllSorted("startDate", Sort.ASCENDING); 

For example, from 10 to 18 years old, and he gives information to who is from 10 to 18.

    1 answer 1

    In addition to the comparison method equalTo() Realm has such methods as:

    greaterThan() , greaterThanOrEqualTo() - more, more or equal

    lessThan() , lessThanOrEqualTo() - less, less or equal

    between() - between

    in your case, the request will be something like this:

     RealmResults<Person> teenagers = realm.where(Person.class).between("age", 13, 20).findAll(); 

    select the Person table entries for which the age field has values ​​from 13 to 20.

    Learn more about compiling requests from official documentation.